CIDR / Subnet Calculator

Enter an IP and CIDR prefix (e.g. 192.168.1.0/24) to get the network address, broadcast address, subnet mask and usable host range.

1,067 views

How It Works

A CIDR block packs two pieces of information into one string: an IP address and a prefix length that says how many of the 32 bits are fixed as the network portion. Take 192.168.1.0/24: the /24 fixes the first three octets (192.168.1) as the network, leaving the last 8 bits free for hosts. Since 8 bits can represent 2⁸ = 256 different values, the block spans 256 consecutive addresses, from 192.168.1.0 through 192.168.1.255.

Two of those 256 addresses are reserved by convention and cannot be assigned to a device: the very first address (192.168.1.0) is the network address, which identifies the subnet itself rather than any host on it, and the very last (192.168.1.255) is the broadcast address, which delivers a single packet to every host on the segment at once. That leaves 256 − 2 = 254 usable host addresses — the number this tool reports as "usable hosts." The same arithmetic scales to any prefix: a /16 leaves 16 host bits (65,536 addresses, 65,534 usable), a /28 leaves 4 (16 addresses, 14 usable), and every step down in prefix length doubles the pool.

The subnet mask (255.255.255.0 for /24) is the same boundary written as four decimal octets instead of a slash number — 24 leading 1-bits followed by 8 zero-bits. The wildcard mask flips that pattern bit for bit (0.0.0.255 for /24) and shows up in Cisco access-list and OSPF configuration instead of a normal subnet mask.

Good to Know

  • /31 and /32 are special cases. A /31 has no bits left to reserve for network/broadcast — RFC 3021 allows both of its two addresses to be used on a point-to-point link. A /32 identifies exactly one address (a single host route), with no network/broadcast distinction at all.
  • This tool never queries the internet. Every value — network address, broadcast, mask, wildcard mask, first/last usable host, host count — comes from binary arithmetic on the 32-bit address you typed, computed entirely in your browser.
  • The IP you enter does not need to be the network address. Enter any host IP with a prefix and the tool derives the network it belongs to — useful when you only know a device's address and need to work out its subnet.
  • Smaller prefix numbers mean bigger blocks. It looks backwards at first, but a /8 is enormous (16.7 million addresses) while a /30 is tiny (4 addresses, 2 usable) — the prefix counts fixed network bits, not host capacity.

Frequently Asked Questions

Why are the first and last address in a subnet not usable as hosts?

The first address is the network address (it identifies the subnet itself, not a device on it) and the last is the broadcast address (a single packet delivered to every host on the segment) — neither can be assigned to one machine. The exception is /31, where RFC 3021 allows both addresses on a point-to-point link, and /32, which has no network/broadcast concept because it describes a single address.

What is a wildcard mask, and why isn't it the same as a subnet mask?

It is the bitwise inverse of the subnet mask — where the mask has a 1 the wildcard has a 0, and vice versa. Cisco ACLs and OSPF network statements use wildcard masks instead of subnet masks, which trips people up the first time they configure a router.

Does this tool check whether my IP is really on that network?

No — it takes whatever IP you type as the reference point and computes the block purely from the prefix length. If you want the network address for an arbitrary host IP, that's exactly what the "Network Address" field gives you; there is no external lookup involved.

How is CIDR different from the old Class A/B/C system?

Classful addressing fixed the network size to /8, /16 or /24 based on the first bits of the address, which wasted huge numbers of addresses for anyone who needed, say, 500 hosts. CIDR (Classless Inter-Domain Routing) lets the prefix length be any value from /0 to /32, so a block can be sized to match actual demand instead of a rigid class boundary.

How do I know how many subnets I can split a larger block into?

Divide by adding bits to the prefix: each extra bit doubles the number of subnets and halves the size of each one. Splitting a /24 into /26 blocks (2 extra bits) gives 4 subnets of 64 addresses (62 usable) each; splitting it into /28 blocks (4 extra bits) gives 16 subnets of 16 addresses (14 usable) each.

Comments

No comments yet — be the first to write one!

Similar Tools