Skip to content

IP subnet calculator

Work out the network, broadcast, usable host range and mask for any IPv4 or IPv6 CIDR.

Divide the network above into equal subnets of this size.
Runs in your browser — nothing is sent anywhere.

The two cases everyone gets wrong

Subnetting is straightforward arithmetic right up until you hit a /31 or a /32, and then most calculators produce nonsense. The textbook rule is "subtract two for the network and broadcast addresses", so a /31 has two addresses minus two, which they print as zero usable hosts. A /32 comes out as minus one.

Both are wrong. RFC 3021 made the /31 a legal point-to-point link precisely so that a link between two routers does not waste half a /30: there is no network address and no broadcast address, and both addresses are usable. A /32 is a single host — a loopback, a container address, a route to one machine. Neither is exotic; you will meet both in the first week of any real network. This calculator handles them explicitly and says why.

IPv6 is not IPv4 with more digits

There is no broadcast address in IPv6 at all — the concept was removed and replaced with multicast — so "usable hosts" does not mean the same thing and this does not pretend it does. Addresses are also 128 bits, which is past the point where JavaScript numbers stay exact, so every address here is handled as a big integer. A calculator using ordinary numbers silently loses precision on IPv6 and produces plausible, wrong answers.

Output is canonicalised the way RFC 5952 requires: lower case, no leading zeros, and the longest run of zero groups compressed to :: — leftmost when two runs tie. That matters more than it sounds, because a different compression is a different string, and string comparison against another tool's output then fails on identical addresses.

Netmasks are validated, not just parsed

You can enter 192.168.1.0 255.255.255.0 as well as a prefix. A netmask has to be a contiguous run of ones, and 255.255.0.255 is a bit pattern rather than a netmask — accepting it produces a confident and completely wrong host range. It is rejected here with a reason.

Splitting a block

Give a longer prefix and you get the count and size of the resulting subnets, and optionally the list of them. This is the calculation behind carving a /24 into four /26s for separate VLANs, and it is the one people most often do on paper and get out by one.

Scope

Each result says whether the address is public, RFC 1918 private, loopback, link-local, carrier-grade NAT or multicast. Link-local in particular is worth flagging: a machine that has given itself a 169.254 address has not been assigned one, which almost always means DHCP failed rather than anything about subnetting.

It runs in your browser

Your internal addressing plan is not something to post to a server, and it does not leave the page. Checked against Python's ipaddress module on every build, across both address families and the awkward prefixes.

01

Common questions

How many usable hosts are in a /31?

Two. RFC 3021 defined the /31 as a point-to-point link with no network or broadcast address, so both addresses are assignable. Calculators that subtract two regardless report zero.

Why does my IPv6 result look different from another tool?

Probably compression. RFC 5952 says to compress the longest run of zero groups, leftmost on a tie. Tools that compress the first run they find produce a different — and non-canonical — string for the same address.

Can I enter a netmask instead of a prefix?

Yes, in either form: "10.0.0.0 255.255.0.0" or "10.0.0.0/255.255.0.0". Non-contiguous masks are rejected rather than silently accepted.

What is the difference between the network and the broadcast address?

The network address is the first in the block, with all host bits zero, and identifies the subnet. The broadcast is the last, with all host bits one, and reaches every host on it. Neither is assignable in IPv4 above a /30.

Does it handle IPv4-mapped IPv6 addresses?

Yes — ::ffff:192.0.2.1 is parsed and printed with the dotted tail, which is the form RFC 5952 recommends and what other tools will show you.

Is anything sent to a server?

No. It runs entirely in your browser.