How to use the CIDR Subnet Calculator
- Type an address followed by a slash and a prefix length (0 to 32), or by a netmask such as 255.255.255.0. A bare address is treated as /32.
- Read the results. Each value has its own copy button.
- To plan smaller networks, pick a longer prefix in "Split into subnets of". The table lists each subnet with its host range, up to the first 64.
How CIDR notation works
An IPv4 address has 32 bits. The number after the slash says how many of the leading bits identify the network; the rest identify a host inside it. A /24 keeps 24 bits for the network and leaves 8 for hosts, so it holds 2^8 = 256 addresses. The matching netmask has 24 one-bits followed by 8 zero-bits: 255.255.255.0.
The network address is the address AND the netmask, which sets every host bit to 0. The broadcast address sets every host bit to 1. The wildcard mask is the netmask inverted (0.0.0.255 for a /24), the form some router access lists use.
Usable hosts
In an ordinary subnet the first address (the network address) and the last (the broadcast address) are not given to hosts, so usable hosts = 2^(32 - prefix) - 2. A /24 has 256 - 2 = 254. A /20 has 4096 - 2 = 4094, and 172.16.5.4/20 falls in the block 172.16.0.0 to 172.16.15.255.
Two prefixes are special. RFC 3021 allows a /31 on point-to-point links, so both of its addresses are usable. A /32 is a single address, such as a loopback or a host route.
Private and special ranges
RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. 169.254.0.0/16 is link-local (RFC 3927), 100.64.0.0/10 is shared address space for carrier-grade NAT (RFC 6598), and 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 are for documentation (RFC 5737). The tool labels the address you enter when it falls in one of these ranges.
Frequently asked questions
How many usable hosts are in a /24?
254. A /24 has 2^8 = 256 addresses; the network address (.0) and the broadcast address (.255) are not assigned to hosts.
What is the difference between a netmask and a wildcard mask?
The wildcard mask is the netmask with every bit flipped. For 255.255.255.0 it is 0.0.0.255. Netmasks mark the network part with 1s; wildcard masks mark the part that may vary with 1s.
Why does the calculator show a different network address than the one I typed?
You typed a host address inside the block. The network address is that address with the host bits cleared, so 192.168.1.10/24 belongs to the network 192.168.1.0/24.
Does this support IPv6?
No. It handles IPv4 only.
Why is a /31 shown with two usable hosts?
RFC 3021 lets point-to-point links use both addresses of a /31 without a network or broadcast address, so the tool counts both.
Sources
- RFC 4632: Classless Inter-domain Routing (CIDR)
- RFC 1918: Address Allocation for Private Internets
- RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links
- RFC 3927: Dynamic Configuration of IPv4 Link-Local Addresses
- RFC 5737: IPv4 Address Blocks Reserved for Documentation
- RFC 6598: IANA-Reserved IPv4 Prefix for Shared Address Space
Last reviewed