CIDR Calculator
Enter an IPv4 address and a prefix length (slash notation) to get every subnet detail you need: network address, broadcast address, subnet mask, wildcard mask, first and last usable host, total hosts, and usable hosts. Results update instantly as you type, with a step-by-step breakdown of the binary math.
What is CIDR notation?
CIDR stands for Classless Inter-Domain Routing. Introduced in 1993 (RFC 1519), it replaced the older classful A/B/C system to make IP address allocation far more efficient. A CIDR block is written as an IPv4 address followed by a slash and a number, for example 192.168.1.0/24. The number after the slash is the prefix length, and it tells you how many leading bits of the address are fixed (the network portion). The remaining bits are free to vary, creating the host addresses within that subnet. A /24 fixes 24 bits and leaves 8 bits for hosts, giving 2^8 = 256 total addresses (254 usable after subtracting the network address and broadcast address). A /16 fixes 16 bits, leaving 16 bits for hosts and producing 65,536 addresses (65,534 usable).
How subnet masks and wildcard masks work
A subnet mask is the dotted-decimal translation of the prefix length. For a /24 prefix, the subnet mask is 255.255.255.0 because the first 24 bits are all 1s and the last 8 are all 0s. To find the network address, perform a bitwise AND between the IP address and the subnet mask: any bits in the host portion are zeroed out. To find the broadcast address, perform a bitwise OR between the network address and the wildcard mask, which is the bitwise complement of the subnet mask. For /24, the wildcard mask is 0.0.0.255. Wildcard masks appear in Cisco ACLs (access control lists) and OSPF area definitions because they let you specify which host bits to match and which to ignore. The first usable host is the network address plus one, and the last usable host is the broadcast address minus one.
Subnetting and VLSM
Variable Length Subnet Masking (VLSM) is the practice of splitting an address block into subnets of different sizes by increasing the prefix length. Starting from a /24 (256 addresses), you can borrow one bit to get two /25 subnets of 128 addresses each, or borrow two bits to get four /26 subnets of 64 addresses each. Each time you increase the prefix by one, you double the number of subnets and halve their size. Route summarisation (also called supernetting) works in reverse: reducing the prefix by one combines two adjacent same-size subnets into one larger block. Both techniques reduce routing table size and make IP addressing more efficient. VLSM is essential for fitting subnets to actual device counts without wasting addresses.
Special CIDR blocks and RFC 1918 private ranges
Several CIDR ranges have reserved meanings. RFC 1918 defines three private address spaces for use inside networks that do not route directly to the internet: 10.0.0.0/8 (about 16.7 million addresses), 172.16.0.0/12 (about 1 million addresses), and 192.168.0.0/16 (65,536 addresses). Home routers almost always use 192.168.1.0/24 or 10.0.0.0/24 from these ranges. Other notable blocks include 127.0.0.0/8 for loopback, 169.254.0.0/16 for link-local (APIPA), and 224.0.0.0/4 for multicast. A /32 host route targets a single IP address and is used in BGP to advertise a specific server or on loopback interfaces of routers. A /30 is the classic point-to-point WAN block with exactly two usable addresses, one for each end of the link. A /31 (RFC 3021) is a newer alternative for point-to-point links that eliminates the network and broadcast overhead entirely.
Common CIDR prefix lengths
| Prefix | Subnet Mask | Usable Hosts | Typical Use |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 | Class A networks, large ISP blocks |
| /16 | 255.255.0.0 | 65,534 | Large campus / cloud VPCs |
| /20 | 255.255.240.0 | 4,094 | Mid-size network or VPC subnet |
| /24 | 255.255.255.0 | 254 | Standard office LAN / Class C |
| /25 | 255.255.255.128 | 126 | Half of a Class C |
| /26 | 255.255.255.192 | 62 | Small VLAN |
| /27 | 255.255.255.224 | 30 | Server subnet |
| /28 | 255.255.255.240 | 14 | Small server group |
| /29 | 255.255.255.248 | 6 | Tiny segment |
| /30 | 255.255.255.252 | 2 | Point-to-point WAN link |
| /31 | 255.255.255.254 | 2 | P2P link, no overhead (RFC 3021) |
| /32 | 255.255.255.255 | 1 | Host route / loopback |
Standard CIDR blocks with their subnet masks, usable host counts, and typical use cases.
Frequently asked questions
What is the difference between a subnet mask and a CIDR prefix?
They represent the same information in different formats. A subnet mask is written in dotted-decimal notation, for example 255.255.255.0. A CIDR prefix writes the same information as a slash and a count of the 1-bits in that mask, so 255.255.255.0 equals /24. You can convert between the two by counting consecutive leading 1-bits in the mask. Both tell routers which part of an IP address is the network and which part is the host.
How many usable hosts does a /24 subnet have?
A /24 subnet has 256 total addresses (2^8 = 256). Two are reserved: the first is the network address and the last is the broadcast address. That leaves 254 usable host addresses. This is the most common subnet size for a single office LAN or VLAN.
What is a wildcard mask and when do I use it?
A wildcard mask is the bitwise complement of a subnet mask. Where the subnet mask has 1s (network bits), the wildcard has 0s, and vice versa. For a /24 subnet (mask 255.255.255.0), the wildcard mask is 0.0.0.255. A 0-bit means "must match exactly" and a 1-bit means "any value is allowed." Wildcard masks are used in Cisco IOS access control lists (ACLs) and in OSPF network statements to specify which addresses a rule applies to.
What is the difference between /30 and /31 for point-to-point links?
A /30 gives 4 total addresses, 2 usable (one for each router end), plus a network address and a broadcast address that are wasted. A /31 (RFC 3021) eliminates this overhead: both addresses are usable because there is no broadcast on a true point-to-point link. Modern routers support /31 natively, saving two addresses per link. On older or stricter equipment you may still need /30.
How do I split a /24 into smaller subnets?
To split a /24, borrow bits from the host portion by increasing the prefix length. One extra bit (/25) gives two subnets of 126 usable hosts each. Two extra bits (/26) gives four subnets of 62 hosts each. Three extra bits (/27) gives eight subnets of 30 hosts each. Each time you increase the prefix by one you double the subnet count and halve the host count. The subnets must start on boundaries that are multiples of their size: a /25 starts at .0 or .128, a /26 starts at .0, .64, .128, or .192.
What are the RFC 1918 private IP address ranges?
RFC 1918 reserves three address blocks for private use inside LANs: 10.0.0.0/8 (Class A, roughly 16.7 million addresses), 172.16.0.0/12 (Class B, about 1.05 million addresses spanning 172.16.0.0 to 172.31.255.255), and 192.168.0.0/16 (Class C, 65,536 addresses). Packets from these ranges are not forwarded by internet routers. They reach the internet only through NAT (Network Address Translation) on a border router or firewall.