Networking
CIDR to Subnet Mask Calculator
Bidirectional converter between CIDR prefix notation (/24) and dotted-decimal subnet masks.
CIDR Prefix Reference
Why /24 Means 255.255.255.0
The number after the slash is simply how many leading bits of the 32-bit address are fixed as the network part. A /24 sets the first 24 bits, which is three full octets of 255 followed by 0, so the mask is 255.255.255.0. A /26 sets 26 bits, so the last octet carries two network bits (128 + 64 = 192) and the mask becomes 255.255.255.192.
The remaining bits decide the size of the block. A /26 leaves 6 host bits, which gives 64 addresses, of which 62 are usable once the network and broadcast addresses are set aside. Use this when a firewall asks for a dotted mask but your cloud console only accepts a prefix, or the other way round.
Common Prefix Sizes in Real Networks
| Prefix | Subnet Mask | Usable Hosts | Typical Use |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 | Very large private cores (rare in practice) |
| /16 | 255.255.0.0 | 65,534 | Campus or VPC-level block |
| /20 | 255.255.240.0 | 4,094 | AWS default VPC subnet |
| /24 | 255.255.255.0 | 254 | Standard office LAN |
| /26 | 255.255.255.192 | 62 | Small department or VLAN |
| /30 | 255.255.255.252 | 2 | Classic point-to-point router link |
| /31 | 255.255.255.254 | 2 (RFC 3021) | Modern point-to-point link |
| /32 | 255.255.255.255 | 1 (host route) | Loopback, VPN endpoint, route filtering |
How the Network Math Works
- Translates prefix length into contiguous 32-bit subnet mask.
Worked Network Example
Common Questions
What is a wildcard mask?
The bitwise inverse of a subnet mask (~mask), used in Cisco ACLs.
How many addresses does a /28 contain?
A /28 leaves 4 host bits: 2^4 = 16 total addresses, minus 2 reserved (network and broadcast), equals 14 usable hosts. Prefixes like /24, /28, /30, and /31 are the most common in everyday routing.
Related Networking
IPv4 Subnet Calculator
Bitwise IPv4 subnetting calculations with full network, broadcast, wildcard, and binary breakdowns.
IP Range Calculator
Calculate span and total quantity of addresses between start and end IPv4 addresses.
IPv4 Address Converter
Transform IPv4 addresses into raw 32-bit decimal, binary octets, and hex notation.