CIDR Calculator

Quick answer

The CIDR calculator converts a CIDR block such as 10.0.0.0/8 into its IPv4 address range, mask, wildcard and host count, and converts any range of IPv4 addresses back into the smallest list of CIDR blocks that covers it exactly.

CIDR
172.161.25.0/25
First IP (network address)
172.161.25.0
Last IP (broadcast address)
172.161.25.127
Subnet mask
255.255.255.128
Wildcard bits
0.0.0.127
Addresses in range
128
Usable host addresses
126
Prefix | host bits
1010110010100001000110010 | 1100110 (25 prefix bits | 7 host bits)

CIDR (Classless Inter-Domain Routing) notation writes a network as an address and a prefix length: 172.16.0.0/12, 10.0.0.0/8, 203.0.113.64/26. The prefix says how many leading bits are fixed; every combination of the remaining bits belongs to the block. Cloud firewalls, VPN configurations, routing tables and allow-lists all speak CIDR.

Going from CIDR to a range is mechanical: the first address has all host bits set to 0 and the last has them all set to 1. The other direction is trickier, because only ranges that start on a boundary and contain a power-of-two number of addresses form a single block. The range 10.0.0.1–10.0.0.31, for example, needs five blocks: /32, /31, /30, /29 and /28.

Choose the direction. In CIDR → range mode the calculator also shows the prefix and host bits of your address so you can see where the boundary falls; in range → CIDR mode it lists every block with its first and last address.

How to use the CIDR Calculator

  1. I want to convert
  2. IP address
  3. Prefix (subnet mask width)
  4. First IP of the range
  5. Last IP of the range

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

How it works

In CIDR → range mode the address is rounded down to a multiple of 2^(32 − n). In range → CIDR mode the calculator repeatedly takes the largest block that starts at the current address, is aligned to its size and does not pass the end of the range, then moves on to the next address.

Worked example

172.161.25.102/25: 25 prefix bits leave 7 host bits, so the block holds 2⁷ = 128 addresses. 102 rounded down to a multiple of 128 is 0, so the range is 172.161.25.0–172.161.25.127, mask 255.255.255.128, wildcard 0.0.0.127, with 126 usable hosts. Converting 10.0.0.1–10.0.0.31 back gives five blocks: 10.0.0.1/32, 10.0.0.2/31, 10.0.0.4/30, 10.0.0.8/29 and 10.0.0.16/28 (1 + 2 + 4 + 8 + 16 = 31 addresses).

Prefix sizes

Prefix Addresses Typical use
/32 1 A single host
/30 4 Old point-to-point links
/24 256 A small LAN
/16 65,536 A campus or VPC
/8 16,777,216 Large private network (10.0.0.0/8)

Formula

Mask = 32 − n host bits · Range = 2³² − n) addresses · First = IP AND mask · Last = first + 2³² − n) − 1 · Range → CIDR: take the largest aligned block that fits, repeat

Worked example

Inputs — I want to convert: CIDR → IPv4 range; IP address: 172.161.25.102; Prefix (subnet mask width): 25.
Results — CIDR = 172.161.25.0/25; First IP (network address) = 172.161.25.0; Last IP (broadcast address) = 172.161.25.127; Subnet mask = 255.255.255.128; Wildcard bits = 0.0.0.127; Addresses in range = 128.

Key terms

Prefix
The fixed leading bits of a CIDR block.
Aligned block
A block whose first address is a multiple of its size.
Wildcard bits
The host part of the mask, written as an inverse mask.

Frequently asked questions

What range does 10.0.0.0/8 cover?

10.0.0.0 to 10.255.255.255 – 16,777,216 addresses.

What does /25 mean?

25 network bits and 7 host bits: 128 addresses, mask 255.255.255.128.

Why does my range need several CIDR blocks?

A single block must start on a multiple of its size and contain a power of two addresses; other ranges must be split.

How many addresses are in a /20?

2¹² = 4,096.

What is 0.0.0.0/0?

Every IPv4 address – the default route.

Is a CIDR block the same as a subnet?

Yes in practice; CIDR is the notation, a subnet is the network it describes.

Sources

  1. RFC 4632 – Classless Inter-domain Routing (CIDR)
  2. IANA – IPv4 Special-Purpose Address Registry

Cite this calculator

Speedy Calculator. (2026). CIDR Calculator. Speedy Calculator. https://speedycalculator.com/calculators/other/cidr/