Quick Answer
A CIDR block’s size depends on its prefix: an IPv4 block has 2^(32 − prefix) addresses. 192.168.10.0/23 has 2⁹ = 512 addresses, from 192.168.10.0 to 192.168.11.255. A range often needs more than one block: 192.168.1.10 to 192.168.1.20 needs 4: 192.168.1.10/31, 192.168.1.12/30, 192.168.1.16/30, 192.168.1.20/32.
Embed this calculator
Adjust the size if needed, then copy the code below into your page or blog. The calculator will load in an iframe and stay updated automatically.
Table of Contents
- CIDR Calculator
- Quick Answer
- Related Calculators
- How This CIDR Calculator Works
- How to Use the CIDR Calculator
- Core Formulas
- Key Terms
- Worked Example
- Real-Life Examples
- CIDR Calculator vs Subnet Calculator
- CIDR Block Sizes
- Merging Blocks Without Adding Addresses
- Tips for Working With CIDR
- Common Mistakes to Avoid
- Frequently Asked Questions
- References & Sources
How This CIDR Calculator Works
CIDR stands for Classless Inter-Domain Routing. It writes a block of IP addresses as an address followed by a slash and a number, such as 10.0.0.0/8. The number is the prefix length: how many bits at the start of the address are the same for the whole block. The remaining bits can change, and they set the size of the block.
This calculator goes both ways. It can turn a block into its first and last address, or find the blocks needed for a range. It can also tidy a list, such as one for a firewall or routing table: it removes repeats, shows entries that overlap and joins blocks that sit next to each other. You can mix blocks, single addresses and ranges, and use both IPv4 and IPv6 in the same list. For usable hosts, the broadcast address and a binary view of one IPv4 subnet, use our Subnet Calculator.
Quick explanation:
- Larger prefix number: a smaller block. A /25 is half of a /24.
- Block start: always a multiple of the block’s size.
- Range to CIDR: use the largest block that fits, then repeat for what’s left.
How to Use the CIDR Calculator
- Choose what you want to do.
- Enter a block, two addresses or a list.
- To split a block, enter the new prefix length.
- Press Calculate or Enter. In the list box, use the Calculate button.
- Copy the result, or save it or share a link.
Core Formulas
- IPv4 addresses in a block: 2(32 − prefix)
- IPv6 addresses in a block: 2(128 − prefix)
- First address: address − (address mod block size), with the address written as one whole number
- Last address: first address + block size − 1
- Blocks made by a split: 2(new prefix − old prefix)
Key Terms
- CIDR: Classless Inter-Domain Routing, which uses /prefix notation for blocks.
- Prefix length: the number of fixed bits at the start of every address in a block.
- Block: a group of addresses whose size is a power of two.
- Aggregation: joining smaller blocks into a larger one.
- Wildcard mask: the opposite of a subnet mask, with 1s for the bits that can change.
Worked Example
Turn the range 192.168.1.10 to 192.168.1.20 into CIDR blocks. It has 20 − 10 + 1 = 11 addresses.
- 10 is a multiple of 2 but not 4, so the largest block that can start there is a /31 (2 addresses): 192.168.1.10/31
- Next is .12, a multiple of 4. A /30 covers .12 to .15: 192.168.1.12/30
- Next is .16. It’s a multiple of 16, but a block of 8 or 16 would go past .20, so use a /30 for .16 to .19: 192.168.1.16/30
- That leaves .20 on its own: 192.168.1.20/32
- Check: 2 + 4 + 4 + 1 = 11 addresses, and nothing extra is included
Real-Life Examples
- Firewall rules: turn a supplier’s address range into blocks your firewall accepts.
- Allow lists: remove repeats and join neighboring blocks.
- Cloud networks: 10.0.0.0/16 splits into 256 blocks of /24.
- IPv6 sites: a /48 has 65,536 blocks of /64.
- Study: check your range-to-CIDR answers.
CIDR Calculator vs Subnet Calculator
- CIDR Calculator: works with ranges, lists and splits, in IPv4 and IPv6.
- Subnet Calculator: explains one IPv4 subnet, with its usable hosts, broadcast address and binary view.
- Total vs usable: this page counts every address. Most IPv4 subnets up to /30 have two fewer addresses for devices.
CIDR Block Sizes
IPv4 sizes come from 2^(32 − prefix), and match the table in RFC 4632. The IPv6 column counts the /64 blocks inside, or 2^(64 − prefix). The IPv4 and IPv6 columns are separate, so blocks on the same row aren’t the same size.
| IPv4 block | Addresses | IPv6 block | /64 blocks inside |
|---|---|---|---|
| /8 | 16,777,216 | /32 | 4,294,967,296 |
| /12 | 1,048,576 | /36 | 268,435,456 |
| /16 | 65,536 | /40 | 16,777,216 |
| /20 | 4,096 | /44 | 1,048,576 |
| /22 | 1,024 | /48 | 65,536 |
| /24 | 256 | /52 | 4,096 |
| /26 | 64 | /56 | 256 |
| /28 | 16 | /60 | 16 |
| /30 | 4 | /63 | 2 |
| /32 | 1 | /64 | 1 |
Merging Blocks Without Adding Addresses
Two blocks of the same size can become one larger block only if they’re next to each other and the first one starts where the larger block would start. 10.0.0.0/24 and 10.0.1.0/24 can become 10.0.0.0/23. 10.0.1.0/24 and 10.0.2.0/24 are also next to each other, but they can’t be joined. A /23 covers 512 addresses, so its third part must be an even number, and 10.0.1.0 can’t start one.
Some tools or routing plans use one larger block that covers both, even if it includes other addresses. This calculator doesn’t do that, because extra addresses in an access rule could let in or block traffic by mistake. If a list can’t be made any shorter, the blocks can’t be joined without adding addresses. Before you change a live firewall or router, check the result against your own network plan.
Tips for Working With CIDR
- Check for overlaps: do this before you connect two private networks.
- Read results as exact: one wrong prefix number doubles or halves the block.
- Plan on block boundaries: ranges that start and end on them need fewer rules.
- Keep both versions in mind: an IPv4 rule doesn’t cover IPv6 traffic.
- Save your lists: name them by site or firewall so you can reopen them later.
Common Mistakes to Avoid
- Thinking a larger prefix number means a larger block. A /16 is much larger than a /24.
- Starting a block at any address. It must start on a multiple of its size.
- Joining any two neighboring blocks. The first must start where the larger block would.
- Treating every address as usable. Most IPv4 subnets set two aside.
- Forgetting IPv6. It needs its own blocks.
Frequently Asked Questions
256 in total. A normal IPv4 subnet has 254 for devices.
Start at the first address, use the largest block that fits without going past the end, then repeat for what’s left.
A CIDR block must be a power of two in size and start on a multiple of that size. Many ranges don’t fit that pattern.
The first 23 bits are fixed. In IPv4, that leaves 9 bits, or 512 addresses.
/16. In IPv4, it has 65,536 addresses, while a /24 has 256.
Yes, if they’re next to each other and the first has an even third number, such as 10.0.0.0/24 and 10.0.1.0/24.
65,536, because 2^(64 − 48) = 65,536.
Yes, all four options work with IPv6.
Yes, for IPv4. For example, enter 10.0.0.0/255.255.255.0.
Choose the merge option and enter them one per line. The results show the overlaps.
Not when you calculate or save. If you use Share link, the entries are in the link, so anyone who has it can read them. Don’t share private network details.
Yes. Save each set by name in this browser.
Yes. Use Compare: keep as A.
Yes. Use Share link or Print.
References & Sources
| Source | Used For | Link |
|---|---|---|
| RFC 4632, Classless Inter-domain Routing (CIDR) | The /prefix notation, power-of-two blocks and the number of addresses at each IPv4 prefix length. | https://www.rfc-editor.org/rfc/rfc4632 |
| RFC 4291, IP Version 6 Addressing Architecture | How IPv6 addresses and prefixes are written, and the main address types. | https://www.rfc-editor.org/rfc/rfc4291 |
| RFC 5952, A Recommendation for IPv6 Address Text Representation | Lowercase letters, no leading zeros, and how to use :: in the short form. | https://www.rfc-editor.org/rfc/rfc5952 |
| Python documentation, ipaddress | Used to check this calculator’s results. It also rejects leading zeros in IPv4 addresses, to avoid confusion with octal numbers. | https://docs.python.org/3/library/ipaddress.html |