CIDR Calculator
Convert between CIDR notation and IP ranges, in either direction.
Convert in either direction. Give a CIDR block such as
192.168.1.0/24 to see the address range it covers, or give a range
such as 192.168.1.10 - 192.168.1.200 to get the smallest set of CIDR
blocks that covers it exactly.
The second direction is the awkward one to do by hand, and it is what you need when translating a range from a firewall ticket into rules a router will accept.
How it works
CIDR notation writes a block of addresses as a starting address and a prefix
length: 192.168.1.0/24 means "the first 24 bits are fixed, the
remaining 8 vary", which is 256 addresses. It replaced the old class-based system
where block sizes were fixed by the leading bits of the address.
The constraint that makes range-to-CIDR interesting is that
a CIDR block cannot start anywhere. Every block must begin on a
boundary that is a multiple of its own size — a /24 must start on a multiple of
256, a /26 on a multiple of 64. So an arbitrary range like
.10 to .200 cannot be one block; it must be decomposed
into several aligned blocks of varying sizes.
The algorithm is greedy: at the current position, take the largest block that both starts on a valid boundary for its size and does not overshoot the end of the range; move to the next address after it; repeat. That produces the minimum number of blocks covering the range exactly, with no addresses outside it.
This matters in practice because getting it wrong is silent and dangerous. It
is tempting to round a range up to a convenient block — but
192.168.1.10/24 does not mean "from .10 onward"; it means the whole
192.168.1.0/24, including the ten addresses you meant to exclude. In
a firewall allowlist, that is a quietly wider hole than intended.
Frequently asked questions
Why does my range need several CIDR blocks?
Because CIDR blocks must start on a boundary aligned to their size. A /24 has to begin on a multiple of 256. An arbitrary range rarely aligns, so it decomposes into several blocks of different sizes that together cover it exactly.
Can I just round up to the nearest block?
You can, but understand what you are doing. Rounding 192.168.1.10-.200 up to 192.168.1.0/24 also includes .0-.9 and .201-.255. In a firewall rule that is a wider opening than intended, and nothing will warn you.
What does /32 mean?
A single address — all 32 bits fixed. It is how you write a host route or a firewall rule for one machine. Likewise /128 is a single IPv6 address.
How many addresses are in a /n?
Two to the power of (32 minus n). A /24 is 256, /25 is 128, /26 is 64, and each additional bit halves it. Subtract two for usable hosts in a normal subnet, since the first and last are the network and broadcast addresses.
Is this the same as a subnet calculator?
Related but different. A subnet calculator tells you what is inside one block — network address, broadcast, usable hosts. This converts between notations, which is what you need when a range is specified as start and end addresses.
Does this handle IPv6?
CIDR-to-range works for IPv6. Range-to-CIDR decomposition is IPv4 only here, since IPv6 ranges are essentially always allocated on clean prefix boundaries and rarely need decomposing.
Related tools
Subnet Calculator
Work out network address, broadcast, usable host range and mask from any CIDR.
Network & IPIP Address Lookup
Find the country, network owner and reverse DNS for any IP address.
Network & IPIPv6 Subnet Calculator
Calculate IPv6 subnets, network prefixes, and address ranges.
Network & IPFirewall Rule Generator
Generate iptables or UFW firewall rules for your Linux server easily.
Server ConfigASN Lookup & Prefix List
Lookup Autonomous System Numbers (ASN), IP prefixes, and network ownership details.
Network & IPHTTP Header Checker
See every response header, the full redirect chain, and where the time goes.
Network & IPNeed hosting that just works?
Free SSL, daily backups and 24×7 support on every Loudhost plan.