# IP & CIDR Range Calculator

Expand a CIDR block into its address range, masks, and host counts, then split it into equal subnets.

---

- **Canonical URL:** https://dothecalculation.com/calculators/ip-cidr-range-calculator
- **Category:** AI & Tech Development
- **Publisher:** Do The Calculation (https://dothecalculation.com)
- **Cost:** Free, no account or sign-up required
- **Privacy:** Runs entirely in the browser; inputs are never sent to a server
- **Methodology:** https://dothecalculation.com/methodology

---

## Expand a CIDR Block Into Its Real Address Range

Turn any IPv4 address and prefix into the network, broadcast, usable host range, subnet and wildcard masks — then split the block into equal subnets.

- The start–end range a firewall rule or security group actually needs
- Wildcard mask for ACL syntax, alongside the standard subnet mask
- Splits a parent block into equal children and lists the boundaries

## Quick Answer — How Do You Calculate a CIDR Range?

The prefix says how many leading bits identify the network. Everything else follows from masking: \(\text{Network} = \text{IP AND Mask}\), \(\text{Broadcast} = \text{Network OR Wildcard}\), \(\text{Total Addresses} = 2^{32-\text{prefix}}\), and \(\text{Usable Hosts} = 2^{32-\text{prefix}} - 2\) — the two exceptions being a /31, where RFC 3021 makes both addresses usable on a point-to-point link, and a /32, which is a single host route.

**Worked example:** `192.168.1.0/24`. Mask **255.255.255.0**, wildcard **0.0.0.255**, network **192.168.1.0**, broadcast **192.168.1.255**, usable range **192.168.1.1 – 192.168.1.254**, **256** total addresses and **254** usable hosts. Scope: private, RFC 1918.

Common prefixes at a glance:

• **/16** — mask 255.255.0.0, 65,536 addresses, **65,534** usable hosts

• **/20** — mask 255.255.240.0, 4,096 addresses, **4,094** usable hosts

• **/22** — mask 255.255.252.0, 1,024 addresses, **1,022** usable hosts

• **/24** — mask 255.255.255.0, 256 addresses, **254** usable hosts

• **/30** — mask 255.255.255.252, 4 addresses, **2** usable hosts

• **/31** — mask 255.255.255.254, 2 addresses, **2** usable (RFC 3021 point-to-point)

• **/32** — mask 255.255.255.255, 1 address, a single host route

Every bit added to the prefix halves the block. That is why /24 and /16 feel so far apart: eight bits of difference is a factor of 256.

## How to Use This Calculator: Planning a VPC Address Range

Enter any address inside the block and the prefix. You do not have to enter the network address itself — the calculator masks whatever you give it down to the block that address belongs to.

Take `10.0.0.0/16`, a common private VPC allocation. Mask **255.255.0.0**, wildcard **0.0.255.255**, range **10.0.0.0 – 10.0.255.255**, first usable **10.0.0.1**, last usable **10.0.255.254**, **65,536** addresses and **65,534** usable hosts, scope **private (RFC 1918)**.

Now split it. Set the child prefix to /24 and the block divides into **256 subnets of 256 addresses each**, starting **10.0.0.0/24, 10.0.1.0/24, 10.0.2.0/24, 10.0.3.0/24** and continuing. Set it to /20 instead and you get **16 subnets of 4,096 addresses**, starting **10.0.0.0/20, 10.0.16.0/20, 10.0.32.0/20, 10.0.48.0/20**.

The boundaries are the part worth checking. A /20 does not start every 20 addresses or every 20 anything — it starts every 4,096 addresses, which lands on the third octet in steps of 16. Getting that wrong is how overlapping subnets end up in a routing table.

## A Second Example: Where Does This Host Actually Live?

The other everyday question is the reverse — you have a host address and a prefix, and you need the block. Enter `10.20.30.40/22`:

The calculator returns **10.20.28.0/22**, not 10.20.30.0/22. Masking 10.20.30.40 with 255.255.252.0 clears the low two bits of the third octet, and 30 in binary is 00011110, which masks down to 00011100 — 28. So the block runs **10.20.28.0 – 10.20.31.255**, usable **10.20.28.1 – 10.20.31.254**, **1,024** addresses and **1,022** usable hosts.

This surprises people regularly, and it is the correct answer rather than a quirk: `10.20.30.40/22` and `10.20.28.0/22` describe the identical block. It matters because a firewall rule written against the address you happened to have in hand covers three other /24s you may not have intended to include.

Two more edge cases worth knowing. `203.0.113.5/31` returns **203.0.113.4 – 203.0.113.5** with **both** addresses usable — RFC 3021 dispensed with the network and broadcast reservation on point-to-point links, which is why /31 is standard on router-to-router links today. And `203.0.113.5/32` is a single address, the form used for host routes and single-IP allowlist entries.

## Subnet Mask, Wildcard Mask, and How This Differs From VLSM

A subnet mask and a wildcard mask carry the same information inverted. The subnet mask sets the network bits to 1 (255.255.255.0 for a /24); the wildcard mask sets the host bits to 1 instead (0.0.0.255). Cisco access control lists and several routing protocols expect the wildcard form, so having both side by side saves a conversion step that is easy to get backwards under pressure.

Scope classification matters more than the legacy address class does. RFC 1918 private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) are not routable on the public internet; RFC 6598 shared space (100.64.0.0/10) is carrier-grade NAT and will collide with your addressing if a provider uses it upstream. The old A/B/C classes are shown for reference, but classful addressing has not governed routing since CIDR replaced it — a /22 does not belong to any class in any operational sense.

This calculator handles a block and equal-sized children. When the subnets you need are deliberately *different* sizes — a 500-host site, a 60-host branch, and a handful of point-to-point links carved from one allocation — that is variable-length subnet masking, and the [subnet calculator](/calculators/subnet-calculator) plans it. Use this one for range expansion and clean binary splits; use that one when the allocation is uneven. For the underlying theory, the [subnetting basics guide](/blog/tech/subnetting-basics) works through CIDR notation, masks, and host counts from first principles.

## Limitations

This calculator is IPv4 only. IPv6 uses the same CIDR prefix idea with a 128-bit address space, but the arithmetic, the notation, and the conventions differ enough that applying these results to an IPv6 plan will mislead you — a /64 is the standard IPv6 subnet and contains more addresses than the entire IPv4 space.

It describes addressing, not reachability. A block being private, correctly masked, and correctly split says nothing about whether traffic actually flows: routing tables, NAT, security group rules, and overlapping allocations elsewhere in your network all decide that. It also cannot tell you whether a range is already in use — the most common real-world CIDR failure is not bad arithmetic but allocating a block that collides with a VPN peer, a partner network, or a default range on some appliance.

The usable-host count assumes conventional host addressing. Some equipment can be configured to use the all-zeros or all-ones address in a subnet, and cloud providers reserve additional addresses inside every subnet you create — typically three to five per block for the gateway, DNS, and future use — so a /24 in a public cloud usually yields fewer than 254 assignable addresses. Check your provider's documentation before sizing a subnet to the exact number of hosts you need.

## Related Calculators

For allocations where the subnets are deliberately different sizes, the [Subnet Calculator](/calculators/subnet-calculator) plans variable-length subnet masking rather than equal binary splits. The [Subnetting Basics](/blog/tech/subnetting-basics) guide covers CIDR notation, masks, and host counts from first principles if you want the theory behind these numbers. When you want to see a mask boundary bit by bit, the [Binary, Hex & ASCII Converter](/calculators/binary-hex-ascii-calculator) converts an octet directly, and once the addressing is settled the [Bandwidth Calculator](/calculators/bandwidth-calculator) sizes the link serving those hosts.

## Frequently asked questions

### How do I calculate the IP range of a CIDR block?

AND the address with the subnet mask to get the network address, then OR that with the wildcard mask to get the broadcast address — those two are the range. For 192.168.1.0/24 the range is 192.168.1.0 to 192.168.1.255, with 192.168.1.1 to 192.168.1.254 assignable to hosts.

### How many usable hosts are in a /24?

254. A /24 contains 2^(32−24) = 256 addresses, minus the network address and the broadcast address, neither of which can be assigned to a host. The same rule gives 1,022 for a /22, 4,094 for a /20, and 65,534 for a /16.

### Why does 10.20.30.40/22 come back as 10.20.28.0/22?

Because they are the same block. A /22 mask clears the low two bits of the third octet, and 30 masks down to 28, so 10.20.30.40 sits inside the block 10.20.28.0/22 which runs from 10.20.28.0 to 10.20.31.255. Any address inside a block resolves to that block's network address.

### What is the difference between a subnet mask and a wildcard mask?

They are bitwise inverses carrying the same information. A subnet mask sets the network bits to 1 — 255.255.255.0 for a /24 — while a wildcard mask sets the host bits to 1 instead, giving 0.0.0.255. Cisco access control lists and some routing protocols use the wildcard form.

### Why does a /31 have two usable hosts instead of zero?

RFC 3021 removed the network and broadcast reservation for point-to-point links, where there is no broadcast domain to identify. That makes both addresses in a /31 assignable, which is why /31 rather than /30 is now standard on router-to-router links — it halves the address waste.

### How many /24 subnets fit in a /16?

256, each containing 256 addresses. The general rule is 2^(child prefix − parent prefix), so a /16 gives 16 /20s, 256 /24s, or 1,024 /26s. Set the split field to see the actual starting boundaries, which is where allocations usually go wrong.

### Which IP ranges are private?

The RFC 1918 ranges 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 are private and not routable on the public internet. 100.64.0.0/10 is RFC 6598 shared space used for carrier-grade NAT, 127.0.0.0/8 is loopback, and 169.254.0.0/16 is link-local. The calculator labels whichever applies.

### Will a /24 give me 254 addresses in a cloud VPC?

Usually not. Cloud providers reserve extra addresses inside every subnet — commonly three to five for the gateway, DNS resolver, and future use — on top of the network and broadcast addresses. Check your provider's documentation before sizing a subnet to the exact host count you need.

## Related concepts

- **CIDR Notation** — An address plus a prefix length, as in 10.0.0.0/16. The prefix counts the leading bits that identify the network; the remainder is host space.
- **Wildcard Mask** — The bitwise inverse of a subnet mask, with host bits set to 1. The form Cisco ACLs and several routing protocols expect — 0.0.0.255 rather than 255.255.255.0.
- **RFC 3021 /31 Links** — A convention that drops the network and broadcast reservation on point-to-point links, making both addresses in a /31 assignable and halving the waste of the older /30 approach.

## Related guides

- [IPv4 Subnetting Basics: CIDR, Masks, and Hosts](https://dothecalculation.com/blog/utility/subnetting-basics) — Learn IPv4 subnetting with a clear /26 example: convert CIDR to a mask, find block boundaries, and calculate network, broadcast, and host ranges.
- [How to Use Do The Calculation Calculators: A Practical Step-by-Step Guide](https://dothecalculation.com/blog/site-guides/how-to-use-calculators) — Learn the fastest reliable workflow for using Do The Calculation calculators, reading results, checking formulas, and using save, print, share, and export actions correctly.

## Related calculators

- [Subnet Calculator](https://dothecalculation.com/calculators/subnet-calculator) — Calculate CIDR notation, subnet masks, usable host counts, and IP address ranges instantly for accurate network planning.
- [IP Subnetting & CIDR VLSM Calculator](https://dothecalculation.com/calculators/sub-grid-mask-calculator) — Calculate subnets, CIDR blocks, and Variable Length Subnet Masking host allocations for efficient IP address planning and design.
- [B-Tree/LSM Index RAM & Disk Overhead Calculator](https://dothecalculation.com/calculators/database-indexing-overhead-calculator) — Calculate indexing overhead size, storage requirements, and RAM block caches for B-Tree and LSM database engines instantly.
- [Domain Name Valuation Estimator](https://dothecalculation.com/calculators/domain-name-valuation-calculator) — Score a domain on extension, length, name type, demand, and age, then value it against a real comparable sale.
- [Kubernetes HPA Replica Count Simulator](https://dothecalculation.com/calculators/kubernetes-hpa-replica-calculator) — Simulate Kubernetes Horizontal Pod Autoscaler scaling metrics, expected replica counts, and pod resource utilization instantly.
- [LLM API Cost Calculator](https://dothecalculation.com/calculators/llm-api-cost-calculator) — Project monthly and annual LLM API spend from request volume, average token counts, per-token pricing, and prompt caching discounts.

---

_This calculator performs exact bitwise arithmetic on the IPv4 address and prefix you enter. It is IPv4 only — IPv6 uses the same prefix idea over a 128-bit space with different conventions. Usable-host counts assume conventional addressing: cloud providers reserve additional addresses inside every subnet, typically three to five per block, so a /24 in a public cloud yields fewer than 254 assignable addresses. Correct addressing also says nothing about reachability, which depends on routing, NAT, and firewall rules._

---

_Source: [Do The Calculation](https://dothecalculation.com/calculators/ip-cidr-range-calculator). Quote freely with attribution and a link to this page._
