Advertisement
Advertisement
Works In Both Directions

CIDR Calculator
CIDR to IP Range, and IP Range Back to CIDR

Most tools only run one way. This CIDR calculator runs both. Paste a CIDR block like 192.168.1.0/24 to get its full IP range, or paste a range like 10.0.0.5 - 10.0.0.20 and get back the exact CIDR blocks that cover it. Masks, single addresses and containment tests all work too.

Quick Answer: What Is a CIDR Calculator?

A CIDR calculator reads classless inter-domain routing notation such as 10.0.0.0/24 and returns the network address, broadcast address, subnet mask, wildcard mask, block size, and usable IP range. This one also works backwards: give it an IP range or a dotted subnet mask and it returns the CIDR blocks that cover it exactly.

Showing a worked example — 10.0.1.0/24. Enter your own block above to replace it.

Network Address

10.0.1.0

Broadcast Address

10.0.1.255

CIDR Notation

10.0.1.0/24

CIDR Analysis: 10.0.1.0/24 Private, RFC 1918 · Class A

First Usable IP

10.0.1.1

Last Usable IP

10.0.1.254

Subnet Mask

255.255.255.0

Usable Hosts

254

Total Addresses

256

Wildcard Mask

0.0.0.255

Where the boundary falls — 24 network bits / 8 host bits

00001010000000000000000100000000

Mask 11111111.11111111.11111111.00000000

Assignable addresses by cloud provider

AWS

251

min /28, reserves 5

Azure

251

min /29, reserves 5

Google Cloud

252

min /29, reserves 4

Counts verified against AWS, Microsoft and Google documentation in August 2026. "n/a" means the provider will not accept a subnet of this size.

Split this block into subnets

/25 /26 /27 /28 /29 /30

Pick a longer prefix to divide 10.0.1.0/24 into equal children.

Every address in this block (256)

Too many to list comfortably, but the full set is one click away. The block runs 10.0.1.0 to 10.0.1.255; the first and last of those are the network and broadcast addresses and cannot be assigned to a host.

Ready to paste

Terraform cidr_block = "10.0.1.0/24"
Cisco ACL access-list 101 permit ip 10.0.1.0 0.0.0.255 any
iptables iptables -A INPUT -s 10.0.1.0/24 -j ACCEPT
AWS CLI aws ec2 create-subnet --cidr-block 10.0.1.0/24
ip route ip route add 10.0.1.0/24 via <gateway>

Summary

The CIDR block 10.0.1.0/24 covers 256 addresses, of which 254 can be assigned to hosts. Its IP range runs 10.0.1.1 to 10.0.1.254, the subnet mask is 255.255.255.0, and the wildcard mask for ACL use is 0.0.0.255. This block sits in Private, RFC 1918 space. For per-host allocation planning inside it, use our IP address calculator.

Robert Harrison, OSINT and Network Utility Expert, explaining CIDR calculator conversions at TrustMyIP

Written & Verified By

Robert Harrison

OSINT & Network Utility Expert

I spend most of my working week inside route tables and cloud address plans. The reason I pushed to make this calculator two-way is a support ticket I kept seeing: someone is handed a range like 10.40.16.0 to 10.40.19.255 by a partner, needs it as a CIDR block for a security group, and has no clean way to convert it. Every calculator I tried only went the other direction.

One honest limitation up front: this tool is IPv4 only, and I would rather say that than return a confident wrong answer for an IPv6 prefix. Everything below reflects how CIDR behaves in production as of August 2026, including the reserved-address counts that AWS, Azure and Google Cloud currently apply.

View all articles by Robert Harrison
Advertisement

What Is a CIDR Calculator and What Does It Actually Return?

A CIDR calculator takes classless inter-domain routing notation — an address followed by a slash and a prefix length, like 10.0.0.0/24 — and expands it into everything a router or firewall needs to know about that block. That means the network address, the broadcast address, the subnet mask, the wildcard mask, the total block size, and the range of addresses you can hand to real machines.

The word doing the work is classless. Before 1993 an address block's size was fixed by its first few bits, so you took 16 million addresses or 254 and nothing in between. CIDR untied size from address, which is why a CIDR block calculator has to be told the prefix explicitly — the address alone no longer implies it. RFC 4632, published by the IETF in August 2006 and still the governing CIDR specification in 2026, is where those rules are set out.

Both Directions, Not Just One

Almost every CIDR notation calculator online runs one way only — a CIDR expander that takes a block in and gives a range out, and nothing more. In practice half the work goes the other way. Someone sends you an allowlist as a start and end address. A vendor gives you a netmask instead of a prefix. You have a single host IP and need it in slash form for a security group. This calculator accepts all of those:

Advertisement
  • CIDR block — 10.0.0.0/24 expands into its full IP range
  • IP range — 10.0.0.5 - 10.0.0.20 collapses into the CIDR blocks that cover it
  • Address and mask — 10.0.0.0 255.255.255.0 converts the subnet mask to a prefix
  • Bare address — 203.0.113.45 returns its /32 form for firewall rules

How the maths runs: all conversion happens server-side in PHP using 32-bit integer bitwise operations, so there is no JavaScript floating-point rounding involved. A /8 holds 16,777,216 addresses and that number comes back exact, not as an approximation.

How Do You Convert CIDR to an IP Range?

To turn CIDR into an IP range, subtract the prefix from 32 to get the host bits, raise 2 to that power for the block size, then count that many addresses forward from the network address. A /24 leaves 8 host bits, so 256 addresses: 10.0.1.0 through 10.0.1.255. The first is the network address and the last is the broadcast, leaving 254 for hosts.

The Boundary Rule Most People Miss

Where this gets misread is any prefix that does not land on an octet boundary. A /22 borrows two bits from the third octet, so it spans four consecutive third-octet values rather than one — and it can only start where those two bits are zero.

Advertisement

# Block: 172.16.36.0/22

host bits = 32 - 22 = 10

block size = 2^10 = 1,024 addresses

# third octet steps by 1024 / 256 = 4

valid starts = .0 .4 .8 .12 ... .36 .40 ...

# 36 is a multiple of 4, so this start is legal

first = 172.16.36.0

last = 172.16.39.255

# 172.16.38.0/22 is NOT legal — 38 is not a multiple of 4

# a router silently reads it as 172.16.36.0/22

# your firewall rule just got 512 addresses wider than you wrote

That silent widening is the failure mode worth remembering. Nothing errors. The rule loads, the config saves, and the block you actually allowed is not the block you typed. Running the value through a CIDR range calculator before you commit it catches it in seconds.

Reading a prefix without a tool: divide the block size by 256 to get the octet step. A /22 steps by 4, a /21 by 8, a /20 by 16, a /18 by 64. If your octet is not a multiple of that step, the start address is wrong.

How Do You Convert an IP Range Back to CIDR?

To convert an IP range to CIDR — sometimes called CIDR translation or finding the CIDR range for a set of addresses — you repeatedly take the largest legal block that starts at your current position and does not overshoot the end, then move forward and repeat. The result is usually more than one block, and that surprises people the first time they see it. A CIDR block must cover a power-of-two count of addresses and begin on a matching boundary, so arbitrary ranges rarely collapse into one.

A Range That Does Not Fit Neatly

Take 10.0.0.5 to 10.0.0.20. That is 16 addresses, which is exactly a /28 — so it looks like it should be one block. It is not, because it starts at .5 instead of a boundary:

# Range: 10.0.0.5 - 10.0.0.20 (16 addresses)

10.0.0.5/32 -> 1 address (.5 is odd, only /32 fits)

10.0.0.6/31 -> 2 addresses (.6 - .7)

10.0.0.8/29 -> 8 addresses (.8 - .15)

10.0.0.16/30 -> 4 addresses (.16 - .19)

10.0.0.20/32 -> 1 address (.20)

# 5 blocks, not 1

# shift to 10.0.0.0 - 10.0.0.15 and it becomes a single /28

I hit this constantly with partner allowlists. Someone sends "our egress is .5 through .20" and the security group needs five entries rather than the one they assumed. If you control the range, moving the boundaries out by a few addresses collapses five rules into one — cheaper to read, cheaper to audit, and under most cloud rule-count limits it genuinely matters.

Converting a Subnet Mask to CIDR

The mask conversion is simpler: count the leading 1 bits. 255.255.255.0 is twenty-four 1 bits, so /24. Going the other way — CIDR to subnet mask — you write that many 1 bits and pad the rest with zeros. The nine values below are the only ones a legal mask octet can hold, because a mask must be an unbroken run of 1s followed by 0s — which is why 255.0.255.0 is a valid address but an invalid mask, and this calculator rejects it.

Mask OctetBinary1 BitsFull Mask ExampleCIDR
0000000000255.255.255.0/24
128100000001255.255.255.128/25
192110000002255.255.255.192/26
224111000003255.255.255.224/27
240111100004255.255.255.240/28
248111110005255.255.255.248/29
252111111006255.255.255.252/30
254111111107255.255.255.254/31
255111111118255.255.255.255/32

If you want to watch the bits flip rather than trust the table, push the address through our IP to binary converter and read the mask boundary directly.

CIDR Prefix Reference: What Each Slash Value Covers

Use this CIDR chart as a quick reference when you do not want to run a conversion. It lists what every commonly used prefix length gives you, expressed the way you actually need it when planning: how many addresses the block holds, how far it steps through the octets, and where you would realistically use it. The cloud column shows assignable addresses after provider reservations, which is the number that bites people in VPC planning.

CIDRAddressesOctet StepCloud Usable (AWS)Where It Fits
/3211 (4th)Not a subnetSingle host in a firewall or route rule
/3122 (4th)Not a subnetPoint-to-point link, RFC 3021
/3044 (4th)Below minimumLegacy router interconnect
/2988 (4th)4 on GCP onlySmall office public allocation
/281616 (4th)11Smallest subnet AWS accepts
/273232 (4th)27Management or bastion subnet
/266464 (4th)59Database tier
/242561 (3rd)251Standard application subnet
/221,0244 (3rd)1,019Kubernetes node pool
/204,09616 (3rd)4,091Availability zone allocation
/1665,5361 (2nd)65,531Whole VPC or enterprise site
/816,777,2161 (1st)Above VPC limitEntire RFC 1918 10.x space

Two provider limits sit behind that column, and both are current as of August 2026. AWS and Azure will not create a subnet smaller than a /28, and each reserves five addresses inside it, so a /28 yields 11 assignable addresses rather than 14. Google Cloud goes one step smaller, accepting a /29, and reserves four rather than five — and it is the only one of the three that lets you widen a subnet in place afterwards instead of rebuilding it.

Where capacity plans usually break: the textbook figure is total minus 2, and every cloud makes it worse. A /28 that looks like 14 addresses is really 11, and a single NAT gateway plus one interface endpoint consumes two of those before a workload lands. If you run EKS or GKE with a VPC-native CNI, every pod takes a real subnet address too.

Why /32 Deserves Its Own Mention

A /32 is one address and nothing else — the CIDR notation for a single IP. It looks odd the first time you write it, because a mask of 255.255.255.255 leaves no host bits at all, but that is the point. Firewall allowlists, route table entries, cloud security groups and BGP host routes all take /32, and it is the tightest rule you can express. Typing a bare address into the calculator above returns its /32 form directly.

The opposite extreme: 0.0.0.0/0 matches every address on the internet. It has legitimate uses in default routes, but attached to an inbound SSH or RDP rule it exposes the host to the entire internet. If you ever see it in an ingress rule, treat it as an incident until proven otherwise.

How Do You Check Whether Two CIDR Blocks Overlap?

Two CIDR blocks overlap when either one contains the other's network address. There is no separate overlap checker needed: expand both blocks here, then check whether their first-to-last IP range intervals touch at any point. Identical blocks are the obvious case. The one that catches people is a wide block quietly swallowing a narrow one — 10.0.0.0/16 and 10.0.5.0/24 look unrelated at a glance, but the second sits entirely inside the first.

Where Overlap Actually Breaks Things

Inside a single routing table, overlap is not fatal. Routers resolve it with longest prefix match — the most specific route wins, so 10.0.5.0/24 beats 10.0.0.0/16 for traffic to 10.0.5.7. That is by design and used deliberately all the time.

Cloud networking is far less forgiving. As of August 2026, VPC peering, transit gateway attachments and site-to-site VPN tunnels on all three major providers still refuse outright when the two sides overlap, with no longest-prefix fallback:

# Identical - rejected

VPC-A 10.0.0.0/16 VPC-B 10.0.0.0/16

# Contained - also rejected, and easy to miss

VPC-A 10.0.0.0/16 VPC-B 10.0.5.0/24

# Adjacent, no shared address - allowed

VPC-A 10.0.0.0/16 VPC-B 10.1.0.0/16

# Different private space entirely - allowed

VPC-A 10.0.0.0/16 VPC-B 172.16.0.0/16

An Allocation Convention That Prevents It

The cheapest fix is a naming convention agreed before anyone opens a console, because you cannot resize a VPC block later without rebuilding it:

  1. Give each environment its own /16 — production 10.0.0.0/16, staging 10.1.0.0/16, development 10.2.0.0/16
  2. Give each region its own second octet if you run multi-region, so 10.10.0.0/16 and 10.20.0.0/16 never collide
  3. Reserve one block for transit, VPN and inspection so shared services always have somewhere to live
  4. Leave a full empty block between tiers, so widening the web tier later does not force renumbering the app tier
  5. Avoid 172.17.0.0/16 entirely — Docker claims it by default, and containers lose connectivity when a VPC uses it too

Understanding which ranges are safe to allocate from starts with knowing the difference between routable and non-routable space, which our guide to public and private IP addressing covers in full.

Supernetting: Combining CIDR Blocks Into One

Supernetting — also called route aggregation or summarization — merges several adjacent CIDR blocks into a single larger one so routers carry fewer entries. It is the same maths as the range conversion above, run in the direction of fewer, bigger blocks. Two conditions have to hold: the blocks must be contiguous, and the combined block must start on its own boundary.

# Contiguous and aligned - aggregates cleanly

10.8.4.0/24 + 10.8.5.0/24 + 10.8.6.0/24 + 10.8.7.0/24

= 10.8.4.0/22

# 4 route entries become 1

# Contiguous but NOT aligned - will not aggregate

10.8.5.0/24 + 10.8.6.0/24 + 10.8.7.0/24 + 10.8.8.0/24

# starts at .5, which is not a multiple of 4

# Not contiguous - will not aggregate

10.8.1.0/24 + 10.8.3.0/24

Every prefix bit you drop doubles the block: a /24 becomes a /23 and then a /22, quadrupling the coverage across two steps. That is also the risk. Aggregating too aggressively advertises address space you do not actually hold, and traffic for those addresses starts arriving at your router with nowhere to go.

Aggregation is why the global routing table remains manageable at all. Transit providers summarize customer blocks before advertising them upstream, so an ISP holding hundreds of small allocations announces a handful of prefixes instead. If you want to see which blocks a given network actually announces, our ASN IP range lookup lists the prefixes registered to any autonomous system.

Testing an aggregate before you advertise it: expand the summary block in the calculator above, then check that every address it covers is genuinely yours. If the summary is wider than your holdings, tighten the prefix by one bit and repeat until it fits.

Wildcard Masks: CIDR Translated for Cisco ACLs

A wildcard mask is the bitwise inverse of a subnet mask: 0 means "this bit must match" and 1 means "ignore this bit". A /24 has subnet mask 255.255.255.0 and wildcard mask 0.0.0.255. You need it the moment you touch Cisco IOS, because access control lists and OSPF network statements take the wildcard form rather than the mask, and getting the two the wrong way round is the single most common lab mistake there is.

# Standard ACL - permit the 192.168.1.0/24 block

access-list 101 permit ip 192.168.1.0 0.0.0.255 any

# wildcard 0.0.0.255 = match first three octets, ignore the fourth

# OSPF network statement across a /16

router ospf 1

  network 10.0.0.0 0.0.255.255 area 0

# A single host is all zeros - nothing may vary

access-list 101 permit ip host 203.0.113.45 any

# equivalent to wildcard 0.0.0.0, which is CIDR /32

The mistake I see most often is pasting 255.255.255.0 where 0.0.0.255 belongs. The command is accepted, the ACL loads, and it then matches an address set that has nothing to do with your intent. There is no warning, because both values are syntactically valid. The wildcard mask returned by the calculator above is ready to paste straight into a config, which removes the flip step entirely.

Wildcard masks are not a routing concept in themselves — they are a matching syntax layered on top of the same bit boundaries CIDR uses. If the underlying network-versus-host split is what feels shaky, our explainer on how subnet masks divide an address is the place to start before returning here.

Reserved CIDR Blocks You Should Never Route

Some CIDR blocks are reserved by IANA for specific purposes, and routing them causes failures that are unusually hard to diagnose because the traffic disappears rather than erroring. I have watched a team lose two days to a VPC built on 100.64.0.0/10 that worked fine internally and dropped every packet the moment it crossed the carrier.

BlockReserved ForFailure If You Route It
0.0.0.0/8"This network", RFC 1122Read as unspecified — packets never leave the host
100.64.0.0/10Carrier-grade NAT, RFC 6598Collides with ISP CGNAT — Starlink and mobile carriers use it
127.0.0.0/8LoopbackNever leaves the machine regardless of route table
169.254.0.0/16Link-local and APIPACloud metadata sits at 169.254.169.254 — breaks instance identity
192.0.2.0/24Documentation, TEST-NET-1Some transit providers null-route it by policy
224.0.0.0/4MulticastNot assignable to hosts at all
240.0.0.0/4Reserved, redesignation under discussionWorks on Linux and macOS, rejected by Windows — see below

240.0.0.0/4 Is the One Row That May Change

The last row is worth watching rather than memorising. 240.0.0.0/4 — the old Class E space, 268 million addresses — has been the subject of an active IETF effort to redesignate it as ordinary unicast space, carried in the Unicast Use of the Formerly Reserved 240/4 draft, which reached its ninth revision during 2025. The practical position today is split: Linux, Android, macOS, iOS, FreeBSD and Solaris have accepted 240/4 as unicast for years, Arista EOS exposes a configuration knob for it, and Windows still treats it as invalid.

That split is exactly why it stays on this list for now. Space that works on two thirds of your fleet and silently fails on the rest is worse than space that fails everywhere, because the failure only appears in production on the hosts you tested least. Until Windows moves, treat 240/4 as unusable in any mixed environment.

The authoritative list is the IANA IPv4 Special-Purpose Address Registry, which is updated as new reservations are made. The ordinary private ranges you should be building on — the RFC 1918 blocks — are broken down with host counts on our IP address calculator.

Address pressure is why so much of this space is now spoken for. The reason carriers reached for 100.64.0.0/10 in the first place is the same reason IPv6 exists, which our piece on IPv4 address exhaustion traces in detail.

CIDR in IPv6: Same Notation, Very Different Scale

CIDR notation works identically in IPv6 — an address, a slash, a prefix length — but the numbers stop being intuitive. IPv4 gives you 32 bits and roughly 4.3 billion addresses in total. IPv6 gives you 128 bits, and a single /64 holds more addresses than the entire IPv4 internet squared.

IPv6 PrefixWhat It AllocatesWho Uses It
/128One addressHost route, firewall rule — the IPv4 /32 equivalent
/64One subnet, 18 quintillion addressesThe standard LAN size — you rarely subnet smaller
/56256 subnetsTypical residential allocation from an ISP
/4865,536 subnetsStandard site or business allocation
/3265,536 /48 sitesISP or large provider allocation

Two habits from IPv4 have to be unlearned. There is no broadcast address in IPv6, so the "subtract 2" arithmetic that governs every IPv4 block simply does not apply — a /64 gives you all of its addresses with nothing reserved off the top. And subnetting below /64 breaks stateless address autoconfiguration, so even when you only need six hosts, you still assign a /64.

To be clear about this tool's scope: the calculator above is IPv4 only, prefixes /0 through /32. IPv6 address counts exceed what 32-bit integer maths can represent, and returning a rounded figure would be worse than returning nothing. For IPv6 address formatting and compression, use our IPv6 address expansion tool, and for the addressing model itself our beginner's guide to IPv6 addresses covers the ground properly.

CIDR Calculator: Frequently Asked Questions

What is a CIDR calculator?

A CIDR calculator reads classless inter-domain routing notation such as 10.0.0.0/24 and returns the network address, broadcast address, subnet mask, wildcard mask, block size and usable range. This one also runs in reverse, turning an IP range or a dotted mask back into CIDR blocks.

How do I convert an IP range to CIDR notation?

Enter the range as start and end separated by a hyphen, such as 10.0.0.5 - 10.0.0.20. The tool returns the smallest set of aligned CIDR blocks that covers it exactly. Most ranges need several blocks, because a block must start on a power-of-two boundary rather than an arbitrary address.

Why does my IP range need more than one CIDR block?

Because a CIDR block always covers a power-of-two count of addresses and must begin on a matching boundary. 10.0.0.5 to 10.0.0.20 is 16 addresses, but starting at .5 forces it into five blocks. Shift it to .0 through .15 and it collapses to one /28.

How do I check whether an IP address is inside a CIDR block?

Type the test directly, for example 10.0.5.7 in 10.0.0.0/16. The calculator compares the address against the block's first and last address and reports whether it falls inside, plus its position within the block. This is the same comparison a router makes when matching a route or a firewall rule.

How do I convert a subnet mask to CIDR?

Count the leading 1 bits. 255.255.255.0 is twenty-four 1 bits, so /24. Paste the mask into the calculator alone, or alongside an address as 10.0.0.0 255.255.255.0. A mask must be an unbroken run of 1s then 0s, so 255.0.255.0 is rejected as invalid.

What is the CIDR notation for a single IP address?

A single host is /32 — 203.0.113.45/32 means that one address and nothing more. Firewall rules, route tables and cloud security groups all accept it, and it is the tightest rule you can write. Entering a bare address into the calculator returns its /32 form automatically.

How do I check whether two CIDR blocks overlap?

Two blocks overlap when either contains the other's network address. Identical blocks are obvious, but a wider block silently swallows a narrower one — 10.0.0.0/16 contains 10.0.5.0/24 entirely. Expand both here and check whether their first-to-last intervals touch at any point.

How do I split a CIDR block into smaller subnets?

Choose a longer prefix than the parent. Splitting a /24 into /26 blocks gives four children of 64 addresses each, starting at .0, .64, .128 and .192. Each extra bit doubles the child count and halves their size. The split panel above lists every child with its own usable range.

Can this CIDR calculator handle IPv6?

No. This tool is IPv4 only, covering /0 to /32. IPv6 prefixes run to /128 and the address counts exceed 32-bit integer maths. The IPv6 prefix table above explains what /48, /56 and /64 allocate, and our IPv6 expansion tool handles IPv6 formatting.

What CIDR block size should I pick for a cloud VPC?

Cloud providers will not let you resize a VPC block after creation, so most architects take a /16 and subnet downward with a full empty block between tiers. Remember AWS and Azure each reserve five addresses per subnet and Google Cloud reserves four, so a /24 yields 251 assignable addresses.

Convert CIDR in Either Direction
Blocks to Ranges, Ranges Back to Blocks

Paste a CIDR block, an IP range, a subnet mask, or a single address. Free, instant, no account — built for firewall rules, VPC planning and route aggregation.