Subnet calculator
Type an IPv4 or IPv6 network in CIDR notation, or an address and netmask, to get its range, host count, masks and type. Then split it or check addresses against it.
| Subnet | Range |
|---|
How to calculate a subnet
- Type a network in CIDR notation, like
192.168.1.0/24or2001:db8::/48. An address with a netmask works too:10.0.0.1 255.255.0.0, and so does a Cisco wildcard mask like0.0.0.255. - You get the network address, netmask, wildcard mask, first and last usable host, broadcast address, host count, address type and the reverse DNS zone. Drag the Prefix slider to see how the numbers change.
- Split the network into equal smaller subnets, check whether an address is inside it, or paste a range like
10.0.0.5 - 10.0.0.20to get the fewest CIDR blocks that cover it, for firewall rules and allow lists.
CIDR cheat sheet
| Prefix | Netmask | Addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 512 | 510 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2 (point-to-point) |
| /32 | 255.255.255.255 | 1 | 1 (single host) |
Private and special addresses
The private IPv4 ranges are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (RFC 1918). 100.64.0.0/10 is carrier-grade NAT, 169.254.0.0/16 is link-local and 127.0.0.0/8 is loopback. In IPv6, fc00::/7 is unique local (private), fe80::/10 is link-local and 2001:db8::/32 is for documentation. The calculator names the block your network belongs to.
Questions
How many hosts are in a /24?
256 addresses, 254 usable: the first is the network address and the last is the broadcast address.
What is the netmask for /24?
255.255.255.0. The prefix length counts the 1 bits in the mask: /24 means 24 ones, then 8 zeros.
What is a wildcard mask?
The inverse of the netmask, used in Cisco ACLs and OSPF: 0.0.0.255 for a /24. You can type either; the calculator recognises both.
Why does /31 have 2 usable hosts?
RFC 3021 lets point-to-point links use both addresses of a /31, since they need no network or broadcast address. A /32 is a single host.
How big is an IPv6 /64?
2^64 addresses, about 18 quintillion. /64 is the standard size for one IPv6 LAN; a /48 holds 65,536 of them.
How do I turn an IP range into CIDR?
Paste it in Range to CIDR, like 10.0.0.5 - 10.0.0.20. You get the fewest CIDR blocks that cover exactly that range, ready for a firewall rule.