CIDR Calculator
Convert a CIDR block to its IP range, mask and host count, or turn any start and end IP into the fewest CIDR blocks.
Need to know which IP addresses are inside 10.0.0.0/22? Or do you have a range like 192.168.0.10 to 192.168.1.200 that you need to enter in a firewall, AWS security group or Nginx allow list? GoogieHost’s free CIDR Calculator handles both directions.
Use CIDR to IP Range to get the first and last IP, subnet mask, wildcard mask and host count of any CIDR block. Use IP Range to CIDR to turn any start and end address into the smallest list of CIDR blocks. It is free, needs no signup and runs in your browser.
What Is CIDR?
CIDR stands for Classless Inter-Domain Routing. It was introduced in 1993 to replace the old Class A, B and C system, which wasted huge numbers of addresses. With CIDR, a network can be any size that is a power of two, not just 256, 65,536 or 16 million addresses.
CIDR also lets routers combine many small networks into one route (route aggregation, or supernetting). This keeps internet routing tables smaller.
What Is CIDR Notation?
CIDR notation writes a network as an IP address followed by a slash and a number, for example 192.168.1.0/24. The number after the slash is the prefix length: how many of the 32 bits are the network part.
- /24 means the first 24 bits are fixed, leaving 8 bits (256 addresses).
- /16 leaves 16 bits, which is 65,536 addresses.
- /32 is exactly one IP address.
The smaller the number after the slash, the bigger the network.
How to Use the CIDR Calculator
CIDR to IP Range
- Select the CIDR to IP Range tab.
- Enter a CIDR block such as 10.0.0.0/22.
- Click Calculate to see the IP range, network and broadcast address, usable hosts, subnet mask and wildcard mask.
If you enter an address that is not the start of its block (for example 10.0.1.5/22), the tool tells you and aligns it to the correct network, 10.0.0.0/22.
IP Range to CIDR
- Select the IP Range to CIDR tab.
- Enter the start and end IP address.
- Click Calculate to get the fewest CIDR blocks that cover that range exactly, plus a ready-to-copy list.
How to Calculate an IP Range From CIDR
Here is how the tool works out 172.16.4.0/22:
- Count the host bits: 32 − 22 = 10 host bits, so the block holds 210 = 1,024 addresses.
- Find the mask: 22 one-bits is 255.255.252.0. The third octet steps in blocks of 4 (256 − 252).
- Find the first IP: 4 is a multiple of 4, so the network starts at 172.16.4.0.
- Find the last IP: Add 1,024 − 1 to get 172.16.7.255.
So 172.16.4.0/22 covers 172.16.4.0 to 172.16.7.255, with 1,022 usable hosts.
How to Convert an IP Range to CIDR
Most ranges do not line up with a single CIDR block. The calculator splits them by repeatedly taking the largest block that starts at the current address and does not go past the end. For example, 192.168.0.10 – 192.168.1.200 becomes 10 blocks, from 192.168.0.10/31 up to 192.168.1.200/32.
This is useful when a provider, country or cloud service publishes its IPs as ranges but your firewall only accepts CIDR.
CIDR Cheat Sheet
Common IPv4 CIDR blocks with their subnet mask, size and typical use:
| CIDR | Subnet Mask | IP Addresses | Number of /24s | Common Use |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 65,536 | Very large networks (e.g. 10.0.0.0/8) |
| /12 | 255.240.0.0 | 1,048,576 | 4,096 | Private range 172.16.0.0/12 |
| /16 | 255.255.0.0 | 65,536 | 256 | Large private network or cloud VPC |
| /20 | 255.255.240.0 | 4,096 | 16 | Medium VPC or campus network |
| /22 | 255.255.252.0 | 1,024 | 4 | Office or data center segment |
| /23 | 255.255.254.0 | 512 | 2 | Two /24s joined (510 hosts) |
| /24 | 255.255.255.0 | 256 | 1 | Typical LAN (old Class C) |
| /25 | 255.255.255.128 | 128 | 1/2 | Half of a /24 (126 hosts) |
| /26 | 255.255.255.192 | 64 | 1/4 | Small department or VLAN |
| /27 | 255.255.255.224 | 32 | 1/8 | Small office VLAN (30 hosts) |
| /28 | 255.255.255.240 | 16 | 1/16 | Small cloud subnet |
| /29 | 255.255.255.248 | 8 | 1/32 | Small server block |
| /30 | 255.255.255.252 | 4 | 1/64 | Point-to-point link (2 hosts) |
| /31 | 255.255.255.254 | 2 | 1/128 | Point-to-point link (RFC 3021) |
| /32 | 255.255.255.255 | 1 | 1/256 | A single host or IP in a firewall rule |
For the wildcard mask and usable host count of every prefix from /16 to /32, see the cheat sheet in our Subnet Calculator.
CIDR vs Subnet Mask
They describe the same thing. /24 and 255.255.255.0 are identical, and so are /20 and 255.255.240.0. CIDR notation is shorter and is what cloud platforms, routers and firewalls usually ask for. A subnet mask is the older dotted form still used in many operating system network settings.
Where You Will Use CIDR Blocks
- Cloud networks: AWS VPCs, Azure VNets and Google Cloud VPCs are all defined with CIDR blocks. AWS allows VPC sizes from /16 to /28.
- Firewalls and security groups: Allow or block a whole range with one rule, such as 203.0.113.0/24.
- Web servers: Nginx allow/deny and Apache Require ip rules accept CIDR. To block or redirect visitors with Apache, see our Htaccess Redirect Generator.
- Kubernetes and Docker: Pod and service networks are set as CIDR ranges.
- BGP and routing: Networks are announced to the internet as CIDR prefixes.
Common Mistakes to Avoid
- Using a host address as the network: 10.0.1.5/22 is not a valid network address; the real block is 10.0.0.0/22.
- Overlapping ranges: Two VPCs or VPN sites with overlapping CIDR blocks cannot be peered or routed cleanly.
- Making blocks too small: Many cloud subnets cannot be resized later, so leave room for growth.
For IPv6 prefixes such as 2001:db8::/48, use the IPv6 Subnet Calculator.
FAQs
What does /24 mean in an IP address?
/24 means the first 24 bits of the address are the network part. It equals the subnet mask 255.255.255.0 and contains 256 addresses, of which 254 can be used by devices.
How many IP addresses are in a /16?
A /16 contains 65,536 IP addresses (2 to the power of 16), with 65,534 usable hosts. It is the same as 256 /24 networks.
What is the IP range of 10.0.0.0/8?
10.0.0.0/8 covers 10.0.0.0 to 10.255.255.255, which is 16,777,216 addresses. It is one of the three private IP ranges defined in RFC 1918.
How do I convert an IP range to CIDR?
Open the IP Range to CIDR tab, enter the start and end address and click Calculate. The tool returns the smallest set of CIDR blocks that covers exactly that range.
Is CIDR the same as a subnet mask?
Yes, they express the same thing in different formats. /24 equals 255.255.255.0, /26 equals 255.255.255.192, and so on. CIDR notation is simply shorter.
What is the main advantage of CIDR?
CIDR lets networks be sized to what they actually need instead of fixed class sizes, which saves IPv4 addresses. It also allows route aggregation, which keeps internet routing tables smaller.
Does this CIDR calculator support IPv6?
This tool works with IPv4. For IPv6 CIDR blocks, use the GoogieHost IPv6 Subnet Calculator, which also splits prefixes into smaller subnets.