Subnet Calculator: IPv4 and IPv6 CIDR, Masks and Host Ranges
This subnet calculator takes an IPv4 or IPv6 address in CIDR notation and returns the network address, broadcast address, usable host range, subnet mask, wildcard mask and a bit-level breakdown, then splits the block into smaller prefixes. Enter 192.168.1.10/24 or 192.168.1.10 255.255.255.0 and the numbers update as you type. Everything is computed in your browser.
How to read CIDR notation
The number after the slash counts the leading 1-bits in the subnet mask. Those bits identify the network; the rest identify hosts inside it. A /24 has 24 network bits and 8 host bits, so it spans 2^8 = 256 addresses. The general form is 2^(32 − prefix) addresses for IPv4 and 2^(128 − prefix) for IPv6.
192.168.1.10/24 and 192.168.1.10 255.255.255.0 describe the same network, and the calculator accepts either form. A mask whose 1-bits are not one solid block — 255.255.0.255 — is rejected rather than silently normalised, because no routing implementation treats it as valid.
Worked example: 10.0.5.130/25 leaves 7 host bits, so the block holds 128 addresses and starts at the nearest 128-boundary below: network 10.0.5.128, broadcast 10.0.5.255, usable 10.0.5.129–10.0.5.254, 126 hosts.
Network address, broadcast address and the usable host range
Every IPv4 block spends two addresses on itself. All host bits set to 0 gives the network address, which names the subnet in routes; all host bits set to 1 gives the directed broadcast address, which reaches every host on the segment. Neither can be assigned to an interface, which is where the usable-host formula 2^(32 − prefix) − 2 comes from.
A /24 gives 256 − 2 = 254 usable addresses, a /26 gives 64 − 2 = 62, a /30 gives 4 − 2 = 2. The only exceptions are /31 and /32, below. Subtract one more for the gateway, which sits inside the block: a /29 leaves 5 addresses for hosts.
Subnet mask and wildcard mask
A subnet mask writes the prefix as dotted decimal: /26 is 255.255.255.192, because 26 one-bits fill three octets plus the top two bits of the fourth (128 + 64 = 192). A wildcard mask is its bitwise inverse, 0.0.0.63 for that same /26. The quick conversion is to subtract each octet from 255.
They are not interchangeable. Cisco and HP ACLs and OSPF network statements take wildcard masks; interfaces, DHCP scopes and routes take subnet masks. Writing 0.240.255.255 where 0.0.15.255 belongs is the classic way an ACL matches the wrong traffic.
IPv4 prefix quick reference: /24 down to /30
Prefix — subnet mask — wildcard mask — total addresses — usable hosts:
/24— 255.255.255.0 — 0.0.0.255 — 256 — 254/25— 255.255.255.128 — 0.0.0.127 — 128 — 126/26— 255.255.255.192 — 0.0.0.63 — 64 — 62/27— 255.255.255.224 — 0.0.0.31 — 32 — 30/28— 255.255.255.240 — 0.0.0.15 — 16 — 14/29— 255.255.255.248 — 0.0.0.7 — 8 — 6/30— 255.255.255.252 — 0.0.0.3 — 4 — 2
Each step down halves the block. Upward, a /23 holds 510 usable hosts, a /22 holds 1,022 and a /16 holds 65,534. To size a subnet, add 2 and round up to the next power of two: 60 hosts needs 62, which rounds to 64 — a /26.
Splitting a block with VLSM
Variable-length subnet masking gives each segment the smallest prefix that fits it instead of cutting the block into equal pieces. Two rules: allocate the largest subnet first, and start every subnet on a multiple of its own size. Splitting 10.10.0.0/24 for a mixed site:
10.10.0.0/25— 126 usable — user VLAN10.10.0.128/26— 62 usable — VoIP10.10.0.192/27— 30 usable — printers10.10.0.224/28— 14 usable — access points10.10.0.240/29— 6 usable — management10.10.0.248/30— 2 usable — router-to-firewall link10.10.0.252/30— 2 usable — spare link
That is 128 + 64 + 32 + 16 + 8 + 4 + 4 = 256 addresses — the whole /24, no overlap, no gaps. Alignment is what makes it work: a /26 may only start at .0, .64, .128 or .192. The split view lists every child subnet with its network, first and last host and broadcast address.
RFC 1918 private ranges and other reserved blocks
Three IPv4 ranges are reserved for private use by RFC 1918 and are never routed on the public internet:
10.0.0.0/8— 10.0.0.0 to 10.255.255.255 — 16,777,216 addresses172.16.0.0/12— 172.16.0.0 to 172.31.255.255 — 1,048,576 addresses192.168.0.0/16— 192.168.0.0 to 192.168.255.255 — 65,536 addresses
The /12 is the one people get wrong: 172.16 through 172.31 are private, 172.32 is not. Also worth recognising are 100.64.0.0/10 (carrier-grade NAT, RFC 6598), 169.254.0.0/16 (link-local) and 127.0.0.0/8 (loopback). The calculator labels the category of whatever you enter, and the what is my ip address page shows the public address your traffic leaves from.
The /31 and /32 special cases
A /31 has two addresses and no room for a separate network and broadcast address, so RFC 3021 makes both usable — one per end of a point-to-point link. Using /31 instead of /30 on router interconnects halves the waste across a large network. Routers support it; some host operating systems, Windows among them, still refuse it on an interface.
A /32 is a single address: one total, one usable, no broadcast. It is the normal form for loopbacks, VPN clients, host routes and firewall rules matching one IP. IPv6 has the same idea in /127 for point-to-point links (RFC 6164) and /128 for a single address.
How IPv6 subnetting differs
IPv6 applies the same prefix arithmetic to 128 bits, written as eight hex groups with :: compressing one run of zero groups. Three things change in practice.
There is no broadcast address. Multicast replaced it — ff02::1 reaches all nodes on the link — so nothing is subtracted and the calculator reports total addresses rather than usable hosts.
/64 is the standard LAN size. Stateless autoconfiguration builds an address around a 64-bit interface identifier, so a LAN prefix longer than /64 breaks SLAAC. Do not subnet below /64 where hosts live; the accepted exception is /127 between two routers. An ISP delegates a /56 (256 /64s) or /48 (65,536 /64s) so you never need to.
The numbers stop being intuitive. One /64 holds 18,446,744,073,709,551,616 addresses. Ranges to know: 2000::/3 global unicast, fc00::/7 unique local, fe80::/10 link-local.
What this calculator does not tell you
This subnet calculator is arithmetic, not discovery: it cannot tell you whether a block is in use, overlaps a subnet elsewhere in your estate, or has a route to it. Nothing is scanned or pinged.
Usable-host counts assume the standard reservation of the network and broadcast addresses; very old gear also refused the all-zeros and all-ones subnets of a classful block, a restriction lifted by RFC 1878. And a public block's math says nothing about who holds it — run an ip address lookup against an address in the range and read the registry record.
Frequently asked questions
My ISP gave me a pool of /29 and /30 — how many usable IPs is that?
Six and two. A /29 holds 8 addresses and a /30 holds 4; in both cases the first address is the network address and the last is the broadcast address, so 8 − 2 = 6 usable and 4 − 2 = 2 usable. On the /30 one of the two is normally the ISP's router, leaving a single address for your equipment. The rule for any IPv4 prefix from /0 to /30 is 2^(32 − prefix) − 2.
How do I work out the broadcast address and host bits from a mask like 255.255.128.0?
255.255.128.0 is a /17 — 17 network bits, 15 host bits, 32,768 addresses, 32,766 usable. Convert the third octet to binary (128 = 10000000) and count the 1-bits to get the prefix. The broadcast address is the block's last address: for 172.16.0.0/17 that is 172.16.127.255, with the usable range running from 172.16.0.1 to 172.16.127.254.
My ISP gave me an IP with a /31 subnet and Windows says invalid address — can a /31 be used at all?
Yes, on a point-to-point link: RFC 3021 makes both addresses of a /31 usable because there is no room for a separate network and broadcast address. Routers from Cisco, Juniper, MikroTik and Linux accept it; Windows' IPv4 interface dialog generally does not, which is the error you are seeing. Configure the /31 on the router that terminates the circuit, not on a laptop.
What is the purpose of assigning a subnet mask of 255.255.255.255?
It pins the interface to exactly one address — a /32, one address total, one usable, no network or broadcast address to subtract. VPN clients, loopback interfaces, host routes and firewall rules use /32 so the host treats every other destination as off-link and hands it to the gateway or the tunnel. Seeing it on a SonicWall or AnyConnect adapter is normal, not a misconfiguration.
How do I choose a subnet mask when I need about 60 hosts per network?
Add 2 for the network and broadcast addresses, then round up to the next power of two. 60 + 2 = 62, which rounds to 64, so you need 6 host bits: a /26, mask 255.255.255.192, 62 usable. A 5-host segment sized the same way gives 7 → 8 → a /29 with 6 usable. Note that four /26s consume an entire /24, so a fifth subnet needs a separate block.
My VLAN is 10.5.0.1 with mask 255.255.240.0 — is 0.240.255.255 the right wildcard mask for the ACL?
No — the correct wildcard is 0.0.15.255. A wildcard mask is the subnet mask inverted octet by octet, so subtract each octet from 255: 255−255 = 0, 255−255 = 0, 255−240 = 15, 255−0 = 255. That /20 covers 10.5.0.0 through 10.5.15.255, which is 4,096 addresses and 4,094 usable hosts. Getting the octets in the wrong order matches traffic you never intended to permit.
If my ISP switches to IPv6, will it issue one IPv6 address per device in my house?
No — the ISP delegates a prefix, typically a /56 or a /48, and your router splits it into /64s, one per LAN. A single /64 holds 18,446,744,073,709,551,616 addresses, so 101 devices costs nothing; each one builds its own address from that prefix via SLAAC. Nobody bills per address, and you never subnet below /64 on a LAN because autoconfiguration expects a 64-bit interface identifier.