CIDR calculator
CIDR calculator for IPv4 and IPv6: network range, subnet mask, wildcard mask, host count, and conversion of a start and end address to CIDR blocks.
About the cidr calculator
CIDR calculator for IPv4 and IPv6: network range, subnet mask, wildcard mask, host count, and conversion of a start and end address to CIDR blocks.
Part of SmartCalcy’s data & networking tools. It runs in your browser with no account, uses your own currency and units (change them at the top of the page), and gives estimates for information only, so check official guidance before you rely on a result.
How to use the cidr calculator
What it calculates and when to use it
Works out the range, subnet mask, wildcard mask and size of a CIDR block for IPv4 or IPv6, accepts an address with a dotted mask, and converts a start and end address into the smallest list of CIDR blocks that cover them exactly.
How to use it, step by step
- Choose “CIDR block” or “Address range”.
- Enter a block such as 192.168.10.0/22, or the first and last address of a range.
- Read the first and last address, masks and number of hosts.
- For a range, copy the list of CIDR blocks.
What each input means
- CIDR block, or address with mask – An IPv4 or IPv6 address followed by /prefix, or an IPv4 address and a dotted mask such as 255.255.252.0.
- First and last address – The two ends of a range, both IPv4 or both IPv6.
How to read the results
- Address range – The first and last address of the block, and the number of addresses.
- Masks – Subnet mask and wildcard mask for IPv4.
- Usable hosts – Addresses available for devices: the total minus the network and broadcast addresses, except /31 and /32.
- CIDR blocks – For a range, the minimum set of blocks that covers it.
The formula
A /n block has 2^(bits − n) addresses, where bits is 32 for IPv4 and 128 for IPv6. The network address is the given address with the host bits set to zero. For IPv4 the usable hosts are 2^(32 − n) − 2. IPv6 uses BigInt arithmetic for exact results.
A worked example
192.168.10.0/22 covers 192.168.8.0 to 192.168.11.255, which is 1,024 addresses and 1,022 usable hosts, with mask 255.255.252.0.
Assumptions and limits
- Usable hosts follow the usual convention of removing the network and broadcast addresses. /31 links use both addresses and /32 is a single host.
- IPv6 blocks have no broadcast address.
- A range that does not fit one block returns several blocks.
Common mistakes
- Entering a host address and expecting it to be the network address. The tool shows the real network address.
- Using a non-contiguous mask such as 255.0.255.0, which is not valid.
- Mixing an IPv4 first address with an IPv6 last address.
Frequently asked questions
What is CIDR notation?
A way of writing an address range as an address and a prefix length, such as 10.0.0.0/8, where the prefix is the number of fixed leading bits.
How many hosts are in a /24?
256 addresses and 254 usable hosts.
What is a wildcard mask?
The inverse of the subnet mask, used in access lists. For 255.255.255.0 it is 0.0.0.255.
What is a /64 in IPv6?
The standard size of one IPv6 subnet, with 2^64 addresses.
Can a range always be one block?
Only if it starts on a boundary and its size is a power of two. Otherwise it is split into several blocks.
Related tools
Block details
- Network address
- 192.168.8.0
- Subnet mask
- 255.255.252.0
- Wildcard mask
- 0.0.3.255
- First usable host
- 192.168.8.1
- Last usable host
- 192.168.11.254
- Broadcast address
- 192.168.11.255
- Total addresses
- 1,024
- Usable hosts
- 1,022
- Prefix length
- /22
- Mask in binary
- 11111111.11111111.11111100.00000000