Calculators
CIDR Calculator
Convert an IPv4 or IPv6 CIDR block into its first and last address, network address, mask and exact address count.
What is cidr calculator?
Classless Inter-Domain Routing (CIDR) writes a network as an address plus the number of fixed leading bits, such as 10.0.0.0/16. This calculator expands that notation into the full range of addresses it covers.
How to use this tool
- Enter an address and prefix and review any options.
- Select Calculate to submit your request.
- Read the result, inspect its source and copy or download the response if needed.
Understanding the results
- First address and last address
- The range the block covers, from the network address to the last address.
- Total addresses
- 2 to the power of the host bits: 32 minus the prefix for IPv4, 128 minus the prefix for IPv6.
- Subnet mask
- The prefix written as a mask. A /16 is 255.255.0.0.
- Network
- Your input with the host bits cleared, which is where the block starts.
Supported features and common uses
IPv4 prefixes from /0 to /32 and IPv6 prefixes from /0 to /128 are supported. Host bits in the input are masked off to find the network boundary. Large IPv6 address counts are returned exactly as whole numbers. For usable host counts and broadcast addresses, use the subnet calculator.
Troubleshooting
Check the address format and prefix. IPv4 prefixes range from 0 to 32; IPv6 prefixes range from 0 to 128.
What CIDR replaced
The early internet divided IPv4 addresses into fixed classes. A class A network had 16 million addresses, a class B had 65,536 and a class C had 256. Nothing fell in between, so an organization that needed 2,000 addresses was given 65,536 and most went unused.
Classless Inter-Domain Routing arrived in 1993 and removed the classes. A network can now be any size that is a power of two, described by a prefix length from 0 to 32.
Reading CIDR notation
A CIDR block is an address followed by a slash and a number. The number is how many leading bits are fixed. Everything after those bits can vary, and that variation is the range of the block.
The smaller the number, the larger the block. Lowering the prefix by one doubles the size, and raising it by one halves it. So a /23 is twice the size of a /24, and a /25 is half of it.
Address counts by prefix
- /8: 16,777,216 addresses.
- /12: 1,048,576 addresses.
- /16: 65,536 addresses.
- /20: 4,096 addresses.
- /24: 256 addresses.
- /28: 16 addresses.
- /32: 1 address.
Where you meet CIDR blocks
- Firewall rules and cloud security groups, where a block says which addresses may connect.
- Virtual networks in cloud platforms, which ask for a block when you create them.
- Allowlists for APIs, databases and admin panels.
- Routing tables, where every route is a block and a next hop.
- SPF records, which can list a sender’s addresses as a block such as ip4:192.0.2.0/24.
When the address is not on a boundary
People often write a block using an address from the middle of it, such as 10.0.5.37/16. The /16 means only the first 16 bits count, so the block really starts at 10.0.0.0. This calculator clears the remaining bits and shows that network address.
Software varies in how it treats such input. Some systems correct it silently and others reject it. Writing the true network address avoids surprises when you paste a block into a firewall or cloud console.
Combining and splitting blocks
Two neighbouring blocks of the same size can merge into one block that is twice as large, but only when they line up on the larger boundary. 192.0.2.0/25 and 192.0.2.128/25 merge into 192.0.2.0/24. Networks do this to keep routing tables short, which is called aggregation.
Splitting goes the other way. Any block divides into two blocks with a prefix one longer. A /24 becomes two /25 blocks, or four /26 blocks, or eight /27 blocks.
IPv6 and CIDR
IPv6 uses the same notation with prefixes from 0 to 128. A single network is normally a /64, a site receives a /48 or a /56, and a provider holds a /32 or larger. The address counts are far beyond anything in IPv4, and the calculator returns them as exact whole numbers.
A worked example
Enter 172.16.40.0/21. A /21 fixes the first 21 bits and leaves 11 free, which is 2,048 addresses. The calculator reports the network as 172.16.40.0, the last address as 172.16.47.255 and the mask as 255.255.248.0. The third number runs from 40 to 47 because a /21 spans eight consecutive /24 blocks.
Now enter 172.16.44.9/21. The answer is the same block, because that address falls inside it and the calculator rounds down to the boundary.
Checking a firewall or allowlist rule
Before you add a block to a firewall, convert it and read the range. People often write a block that is far larger than they meant. A rule for 10.0.0.0/8 covers more than 16 million addresses, when the intention was the 256 in 10.0.0.0/24.
The same check helps when a provider publishes the ranges its service uses. Convert each block to see how many addresses you are about to trust.
Terms used on this page
- CIDR block: an address and a prefix length that together describe a range.
- Prefix length: the number of leading bits that are fixed.
- Network address: the first address of the block, with all the free bits set to zero.
- Host bits: the bits after the prefix, which vary within the block.
- Aggregation: merging neighbouring blocks into a single larger one.
- Default route: the block 0.0.0.0/0, which matches every address.
Why the calculator contacts nothing
The arithmetic happens on our server and involves no network traffic. The address you enter is never contacted, so private ranges and addresses you do not own are fine to use. That makes the calculator safe for planning internal networks.
Frequently asked questions
Good questions. Clear answers.How do I find the IP range of a CIDR block?
Enter the block, such as 10.0.0.0/16. The first and last address fields show the range it covers, here 10.0.0.0 to 10.0.255.255.
How many addresses are in an IPv6 /64?
18,446,744,073,709,551,616, which is 2 to the power of 64. The calculator returns the exact count.
What does /0 mean?
A zero-length prefix covers the entire IPv4 or IPv6 address space. It does not mean every address is assignable.
What does the number after the slash mean?
It is the prefix length, the count of leading bits that are the same for every address in the block. The remaining bits can take any value.
What is the IP range of a /24?
256 consecutive addresses. For 192.168.1.0/24 the range runs from 192.168.1.0 to 192.168.1.255.
How many addresses are in a /16?
65,536. The range covers every value of the last two numbers, such as 10.0.0.0 to 10.0.255.255.
Is a bigger prefix number a bigger network?
No. A bigger number fixes more bits and leaves fewer to vary, so the block is smaller. A /30 has 4 addresses and a /8 has more than 16 million.
What is the difference between CIDR and a subnet mask?
They describe the same boundary. CIDR writes it as a count of bits, such as /24, and a subnet mask writes it as four numbers, such as 255.255.255.0.
How can I check whether an address is inside a block?
Convert the block to its first and last address here, then see whether your address falls between them.
What is 0.0.0.0/0?
The block that contains every IPv4 address. In a routing table it is the default route, and in a firewall rule it means traffic from anywhere.
How do I write a single address in CIDR notation?
Add /32 for IPv4 or /128 for IPv6. 203.0.113.5/32 means that one address and nothing else.
What CIDR block covers a specific range of addresses?
Only ranges that start on a boundary and have a size that is a power of two fit one block. Other ranges need several blocks. Try prefixes here until the first and last address match your range.
Why did the network address change from what I typed?
The address you entered was inside the block and not at its start. The calculator shows the true first address of the block.
Does a CIDR block always start at an address ending in zero?
No. A /26 can start at .0, .64, .128 or .192, and a /30 can start at any multiple of four. Blocks start at multiples of their own size.
Can I use CIDR notation for IPv6?
Yes. IPv6 always uses it, because IPv6 has no dotted masks. Enter a block such as 2001:db8::/48 to see its range.