What is the IP Subnet / CIDR Calculator?
CIDR notation (Classless Inter-Domain Routing) writes a network as an address plus a prefix length, such as 192.168.1.0/24. The prefix says how many leading bits identify the network. The remaining bits number the hosts inside it, so a /24 has 28 = 256 addresses, a /26 has 64 and a /16 has 65,536.
This subnet calculator takes an IPv4 address with a prefix (10.0.5.17/20) or a dotted netmask (10.0.5.17 255.255.240.0). It works out the network address, broadcast address, netmask, wildcard mask (used in Cisco ACLs and OSPF), first and last usable host and the number of hosts. It also says whether the address is private, public, loopback or CGNAT, which is useful when planning VPCs on AWS, Azure or Google Cloud, home networks or firewall rules. Drag the slider to compare prefix sizes.
How to use the IP Subnet / CIDR Calculator
- Enter an IPv4 address with a CIDR prefix, for example
172.16.40.9/22, or with a netmask. - Read the network, broadcast and usable host range in the table.
- Drag the prefix slider to see how the subnet changes size.
CIDR prefix 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 |
| /24 | 255.255.255.0 | 256 | 254 |
| /26 | 255.255.255.192 | 64 | 62 |
| /28 | 255.255.255.240 | 16 | 14 |
| /30 | 255.255.255.252 | 4 | 2 |
| /32 | 255.255.255.255 | 1 | 1 (single host) |
Frequently asked questions
Why are there 2 fewer usable hosts than addresses?
The first address identifies the network and the last is the broadcast address, so neither can be assigned to a device. The exceptions are /31 (point-to-point links, RFC 3021) and /32 (a single host).
How many usable IPs does an AWS subnet have?
AWS reserves 5 addresses in every subnet (the first four and the last), so a /24 VPC subnet has 251 usable addresses, not 254. Azure also reserves 5.
Which IP ranges are private?
RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. They are not routed on the public internet.