devopscodepro
Language
Runs entirely in your browser — nothing leaves this page.

Subnet / CIDR calculator

IPv4 and IPv6 networks: ranges, netmask, contains-IP check, splitting into subnets and the v4-in-v6 address forms.

network192.168.1.0/24
netmask255.255.255.0
broadcast192.168.1.255
first host192.168.1.1
last host192.168.1.254
usable hosts254

What the calculator shows

Give it a network in CIDR notation — IPv4 or IPv6 — and it returns the range that block actually covers: network address, netmask, broadcast, the first and last usable host, and how many addresses fit. It also answers whether a specific address falls inside the block.

Useful when writing a security group, a NetworkPolicy or a route, where an off-by-one prefix silently doubles or halves what you just allowed.

Two more jobs live here: split a block into equal subnets by picking a longer prefix (a /24 into four /26s, a /48 into /52s per rack), and translate between the IPv4-in-IPv6 forms — the ::ffff: mapped notation that shows up in dual-stack logs, and the 6to4 2002::/16 prefix an address corresponds to.

Why is the usable host count two less than the total?

The first address identifies the network and the last is the broadcast, so neither can be assigned to a host. A /24 covers 256 addresses and hosts 254 of them.

What happens with /31 and /32?

They are the exceptions. A /32 is a single address — a host route. A /31 is two addresses with no network or broadcast reserved, used for point-to-point links (RFC 3021). Applying the usual minus-two rule to them gives nonsense.

How do I pick a prefix for a subnet?

Work backwards from the host count you need plus growth, then round up to the next power of two and subtract the two reserved addresses. Cloud providers also reserve a few addresses per subnet — AWS takes five — so a /28 gives you fewer usable hosts there than the arithmetic suggests.

Related tools: Port checker, DNS lookup and GeoIP lookup.