Subnet and CIDR calculator for IPv4 and IPv6
Work out the network, broadcast, host range and mask of any IPv4 or IPv6 subnet.
Calculated in your browser. Nothing is sent to our servers.
Type an address with a prefix, such as 192.168.10.0/24 or 2405:200::/48, and the calculator shows the network address, usable host range, broadcast address, subnet and wildcard masks, and the address type. For IPv4 you can give a dotted mask instead of a prefix. Results update as you type.
How subnetting works
An IPv4 address is 32 bits. The prefix length (the number after the slash) says how many of those bits identify the network; the rest identify hosts. A /24 leaves 8 host bits, so it holds 256 addresses. The first is the network address and the last is the broadcast address, which leaves 254 usable hosts.
The wildcard mask is the inverse of the subnet mask. Access lists on Cisco routers and OSPF network statements use it.
Special cases
- /31: used on point-to-point router links (RFC 3021). Both addresses are usable and there is no broadcast.
- /32: a single host, typically a loopback or a host route.
- 100.64.0.0/10: carrier-grade NAT space used by ISPs; it is not public and not RFC 1918.
IPv6 in short
IPv6 addresses are 128 bits written as eight groups of hex digits. Leading zeros can be dropped and one run of zero groups can be replaced with ::. LAN segments are almost always /64. A site usually receives a /48 or /56 from its ISP, which gives 65,536 or 256 /64 networks.
IPv4 subnet cheat sheet
| Prefix | Subnet mask | Usable hosts |
|---|---|---|
| /20 | 255.255.240.0 | 4,094 |
| /21 | 255.255.248.0 | 2,046 |
| /22 | 255.255.252.0 | 1,022 |
| /23 | 255.255.254.0 | 510 |
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /29 | 255.255.255.248 | 6 |
| /30 | 255.255.255.252 | 2 |
| /31 | 255.255.255.254 | 2 (point-to-point) |
| /32 | 255.255.255.255 | 1 (single host) |
Common questions
What is the difference between a subnet mask and a prefix?
They describe the same thing. 255.255.255.0 and /24 both mean the first 24 bits are the network. The prefix is shorter to write and is what IPv6 uses.
How many hosts fit in a /26?
A /26 has 64 addresses and 62 usable hosts. Each step down in prefix length doubles the size: /25 has 126 usable, /24 has 254.
Why does my /31 show two usable hosts?
RFC 3021 allows /31 on point-to-point links, where no network or broadcast address is needed. Most modern routers support it and it saves addresses.
What prefix should an IPv6 LAN use?
Use /64 for every LAN segment. SLAAC and many IPv6 features assume a 64-bit interface identifier.

