CIDR Calculator
Enter a CIDR notation block to see its subnet details.
What this calculator does
Enter a CIDR block such as 192.168.1.0/24 and the calculator returns four derived values at once: the subnet mask (255.255.255.0), the network address (192.168.1.0), the broadcast address (192.168.1.255) and the count of usable hosts, which is 254 for the default block. All four follow from the prefix length alone, so the same arithmetic works for any IPv4 prefix from /0 to /32.
The host-count formula
An IPv4 address is 32 bits wide. The number after the slash, the prefix, fixes that many leading bits as the network portion; the remaining 32 − prefix bits belong to individual hosts. Each host bit can be 0 or 1, so the block contains 2^(32 − prefix) addresses in total. Two of them are never assignable: the all-zero host pattern is the network address and the all-one pattern is the broadcast address. Subtracting those two reserved values gives the usable count.
The subnet mask is the same prefix written in dotted form: the first n bits are 1 and the rest are 0. For a /24 that is 11111111.11111111.11111111.00000000 in binary, which reads as 255.255.255.0. ANDing any address with the mask produces the network address, and ORing it with the inverted mask produces the broadcast address. This is exactly the arithmetic the calculator performs on your input.
Worked example: 192.168.1.0/24
The default input has a prefix of 24, so 32 − 24 = 8 host bits and 2^8 = 256 total addresses. The network address is 192.168.1.0 and the broadcast address is 192.168.1.255. Removing the two reserved endpoints leaves 256 − 2 = 254 usable hosts, spanning 192.168.1.1 through 192.168.1.254. A typical home router on this block hands out DHCP leases from that same span, which is why the /24 is the most familiar prefix in private networking.
The pieces of a subnet
- Network address: the first address, all host bits zero — 192.168.1.0 in the default block
- Broadcast address: the last address, all host bits one — 192.168.1.255 here
- Usable hosts: everything between the two, minus network and broadcast — 192.168.1.1 to 192.168.1.254
- Subnet mask: the prefix as a dotted value — 255.255.255.0 for any /24
Host counts by prefix length
Every prefix step of one bit doubles or halves the block. Going from /24 to /25 cuts 256 addresses to 128; going from /16 to /15 doubles 65,536 to 131,072. The table below lists the exact counts the formula produces, so you can sanity-check any plan without recomputing powers of two by hand.
| Prefix | Subnet mask | Total 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 |
| /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) |
The last two rows are special cases. RFC 3021 allows both addresses of a /31 to be used on point-to-point links, so nothing is subtracted, and a /32 names exactly one address with no network or broadcast distinction. The calculator follows this convention: prefixes of 31 and above return the full total.
Reading the prefix length
A /24 means the first 24 bits are the network, leaving 8 bits (256 addresses) for hosts. A /16 leaves 16 bits (65,536 addresses), and a /28 leaves only 4 bits (16 addresses). A quick mental shortcut: subtract the prefix from 32, raise 2 to that power for total addresses, then subtract 2 for usable hosts. For a /26 that is 32 − 26 = 6, 2^6 = 64 total, 62 usable.
Common mistakes with CIDR notation
- Counting the network and broadcast addresses as assignable, which overbooks the block by two hosts
- Writing a dotted mask such as 255.255.255.0 in the CIDR field — the calculator expects the prefix form
- Assuming an octet boundary is required: a /26 mask of 255.255.255.192 is perfectly valid
- Mixing up the mask with the wildcard mask used in access lists, which is 0.0.0.255 for a /24
- Typing 10.0.0.1/24 and quoting 10.0.0.1 as the network address in documentation or firewall rules
The last point matters for correctness, not just tidiness. The compute logic ANDs the input address with the mask, so 10.0.0.1/24 and 10.0.0.0/24 both produce the network 10.0.0.0. If you hand 10.0.0.1/24 to a person instead, they may quote 10.0.0.1 as the network address and misconfigure a route around it. Always quote a block by its network address.
Splitting a /24 into smaller subnets
Sizing a network means picking a prefix large enough for current devices plus growth. A /26 holds 62 usable hosts, so four /26 subnets fit inside one /24 (4 × 64 = 256 addresses): 192.168.1.0/26, 192.168.1.64/26, 192.168.1.128/26 and 192.168.1.192/26. Each new block starts on a boundary that is a multiple of its own size, which is the rule to remember when carving up any larger block.
Reserve headroom when you choose. A VLAN with 40 devices fits a /26 with 22 spare addresses, but a department that doubles to 80 devices overflows it, forcing a renumber into a /25 with 126 hosts. Renumbering is disruptive — every static assignment, DHCP reservation and firewall rule changes — so it is usually cheaper to start one prefix size larger than today’s count requires.
Why network and broadcast addresses are off limits
The network address identifies the block itself and appears in routing tables as the destination prefix, so assigning it to a host would make routes ambiguous. The broadcast address reaches every host in the block: traffic sent to 192.168.1.255 is delivered to all 254 devices at once. Giving that address to one machine would intercept traffic meant for everyone. Some operating systems tolerate assigning these addresses, but the behavior is undefined across vendors and breaks the broadcasts that DHCP discovery and ARP still rely on. Keeping both reserved is the only portable choice, and it is why the formula subtracts two.
Frequently asked questions
Why are two addresses subtracted?
The network and broadcast addresses cannot be assigned to hosts, so the usable count is the total minus two. In 192.168.1.0/24 that removes 192.168.1.0 and 192.168.1.255, leaving 254 of 256 addresses.
How many usable hosts does a /26 have?
A /26 leaves 32 − 26 = 6 host bits, so 2^6 = 64 addresses and 62 usable hosts after subtracting network and broadcast. Four such subnets fit in one /24.
What is a /32?
A /32 covers exactly one address and is often used for routing a single host. The calculator reports 1 usable address for it, with no separate broadcast.
Why does a /31 have 2 usable hosts instead of 0?
RFC 3021 allows both addresses on a point-to-point link between two routers, so no subtraction applies. The calculator returns the full total of 2 for prefixes of 31 or more.
Is CIDR the same as a subnet mask?
They describe the same split. CIDR writes it as a prefix length, while a subnet mask writes it as a dotted value like 255.255.255.0 — both mean the first 24 bits are network.
What is the usable range of 192.168.1.0/24?
192.168.1.1 through 192.168.1.254. The endpoints 192.168.1.0 (network) and 192.168.1.255 (broadcast) are reserved, which is why the block serves 254 hosts, not 256.
Can I assign the network address to a device?
No. The network address stands for the block itself in routing tables, and the broadcast address reaches every host in the block. Assigning either breaks DHCP discovery and ARP-dependent traffic.
How many /28 subnets fit in a /24?
16. A /28 has 16 addresses, and 16 × 16 = 256, so the subnets start at 192.168.1.0, .16, .32 and so on up to .240. Each serves 14 usable hosts.
What does the calculator do with an input like 10.0.0.1/24?
It masks the address to its network, returning 10.0.0.0 with broadcast 10.0.0.255 and 254 usable hosts. The input address itself is not preserved as the network address.
Method and sources
- CIDR (RFC 4632) subnetting and host-count formulas.