ipconfig.co.uk

Subnet and IPv6 calculator

Type an address as your tools print it (192.168.1.42/24, 192.168.1.42 255.255.255.0, or 2a00:23c4:5f1a:8b00::1c3e/64) and get everything derived from it. Runs entirely in your browser.

IPv4 subnet calculator

Accepted: a.b.c.d/nn, a.b.c.d nn, a.b.c.d 255.255.255.0, or a.b.c.d alone (assumes /32). Also accepts a bare mask like 255.255.240.0 to convert it.

IPv6 calculator

Expands, compresses, shows the network prefix, address type and the reverse-DNS name. A zone ID (%12, %eth0) is ignored. Prefix defaults to /64.

Mask and prefix length reference

CIDRMaskWildcardHexAddressesUsable hosts
/8255.0.0.00.255.255.2550xff00000016,777,21616,777,214
/9255.128.0.00.127.255.2550xff8000008,388,6088,388,606
/10255.192.0.00.63.255.2550xffc000004,194,3044,194,302
/11255.224.0.00.31.255.2550xffe000002,097,1522,097,150
/12255.240.0.00.15.255.2550xfff000001,048,5761,048,574
/13255.248.0.00.7.255.2550xfff80000524,288524,286
/14255.252.0.00.3.255.2550xfffc0000262,144262,142
/15255.254.0.00.1.255.2550xfffe0000131,072131,070
/16255.255.0.00.0.255.2550xffff000065,53665,534
/17255.255.128.00.0.127.2550xffff800032,76832,766
/18255.255.192.00.0.63.2550xffffc00016,38416,382
/19255.255.224.00.0.31.2550xffffe0008,1928,190
/20255.255.240.00.0.15.2550xfffff0004,0964,094
/21255.255.248.00.0.7.2550xfffff8002,0482,046
/22255.255.252.00.0.3.2550xfffffc001,0241,022
/23255.255.254.00.0.1.2550xfffffe00512510
/24255.255.255.00.0.0.2550xffffff00256254
/25255.255.255.1280.0.0.1270xffffff80128126
/26255.255.255.1920.0.0.630xffffffc06462
/27255.255.255.2240.0.0.310xffffffe03230
/28255.255.255.2400.0.0.150xfffffff01614
/29255.255.255.2480.0.0.70xfffffff886
/30255.255.255.2520.0.0.30xfffffffc42
/31255.255.255.2540.0.0.10xfffffffe22
/32255.255.255.2550.0.0.00xffffffff11

/31 has two usable addresses on point-to-point links (RFC 3021) and /32 is a single host; every other prefix loses the network and broadcast addresses.

How the calculation works

An IPv4 address and its mask are both 32-bit numbers. The network address is the bitwise AND of the two; the broadcast address is the network OR the inverted mask (the wildcard). Everything between them is the host range. The prefix length is simply the count of 1-bits in the mask, which is why 255.255.255.0 and /24 are the same thing. The binary view below the results shows the boundary: green bits are the network part, yellow bits are the host part.

IPv6 works the same way with 128 bits, but the mask is always written as a prefix length, and there is no broadcast address; the all-zero host part is the subnet-router anycast address, and hosts are otherwise free to use any interface identifier.

Related pages

Last reviewed . Command syntax verified against Windows 11, Ubuntu 24.04, macOS 15 and FreeBSD 14 unless noted otherwise.

Spotted a mistake or a switch we have missed? Every page on this site is written to be checked against real output, so please test on your own machine and compare.