CIDR calculator
Enter an IPv4 address with a prefix or a subnet mask and get the network, broadcast, first and last host, wildcard mask and host count. Handles /31 and /32.
CIDR notation (10.0.0.5/20), or an address and a mask (10.0.0.5 255.255.240.0).
Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.
How to use the CIDR calculator
- Type an IPv4 address with a prefix, such as 192.168.1.10/24.
- Or type an address and a mask: 192.168.1.10 255.255.255.0.
- Read the network and broadcast addresses, the usable host range and the masks.
- Check the host count before you put the range in a rule.
About this tool
CIDR notation writes a block of IP addresses as an address and a prefix length: 10.0.0.0/8, 192.168.1.0/24. The prefix says how many leading bits are fixed. The rest are free, so a /24 has 8 free bits and 256 addresses, and each step down in the prefix doubles the block. A subnet mask says the same thing in dotted form: /24 is 255.255.255.0.
You need the exact range whenever a rule is written in CIDR: a firewall rule, a cloud security group, an allow list, a VPN route. A range that is one bit too wide can open a service to twice as many addresses as intended. The classic mistake is 0.0.0.0/0, which is every address on the internet, left on a database or SSH port.
In an ordinary subnet the first address names the network and the last is the broadcast address, so the usable hosts are the ones in between. Two sizes are special. A /31 has two addresses and both are usable, for point-to-point links (RFC 3021). A /32 is a single host. This calculator handles both.
Sources
Questions
A /24 has 256 addresses. The first is the network address and the last is the broadcast address, which leaves 254 usable hosts. In general a prefix of n gives 2 to the power of (32 − n) addresses, minus two.
They are bitwise opposites. The subnet mask has ones for the network bits (255.255.255.0 for a /24) and the wildcard mask has ones for the host bits (0.0.0.255). Cisco access lists and OSPF use wildcard masks.
Yes, on point-to-point links. RFC 3021 allows both addresses of a /31 to be assigned to hosts, with no network or broadcast address. It halves the address use of the /30 that such links needed before.
It is the block with no fixed bits: every IPv4 address. In a route it is the default route. In a firewall rule or a security group it means anyone on the internet, which is rarely what an admin port or a database should allow.