IP Subnet Calculator

Paste an IPv4 address with a CIDR prefix or a dotted netmask and get the network, broadcast, wildcard mask, usable range and host count in your browser.

๐ŸŒ Espaรฑol

๐Ÿ”’ Private by design: your text is processed locally in your browser and never uploaded to any server.

Subnetting is bit arithmetic wearing a decimal disguise

An IPv4 address looks like four numbers because that is how it is written down, but every operation you perform on it happens on the underlying 32 bits. The network address is the address with all host bits cleared. The broadcast address is the same address with all host bits set. The usable range is everything strictly between them. The wildcard mask is the netmask flipped.

All of that is trivial in binary and awkward in dotted decimal, which is why people reach for a calculator rather than doing it in their head. Getting it wrong produces a route or a firewall rule that looks reasonable and matches the wrong set of hosts, which is the kind of mistake that takes a long afternoon to find.

Calculating a subnet

  1. Paste an address with either a CIDR prefix or a dotted netmask into the input box.
  2. Run it. The report opens by echoing back the interpretation it settled on.
  3. Read the netmask, network, and usable host sections.
  4. Consult the reference table at the bottom if you are sizing a subnet rather than describing one.

The edge cases most calculators get wrong

Two prefixes break the simple formula, and both are common enough that getting them wrong matters.

A /31 has exactly two addresses. Subtracting a network address and a broadcast address from two leaves zero usable hosts, which would make a /31 useless, and yet /31 links are standard practice on point to point circuits because a dedicated standard says both addresses are usable there and no network or broadcast address exists. This calculator reports two usable and marks the other two lines as not applicable.

A /32 has one address and describes a single host, which is how a loopback or a host route is expressed. Same treatment: one usable, no network, no broadcast.

There is a third trap that is invisible rather than merely unusual. In JavaScript, shifting a value left by 32 places wraps around to shifting by zero, so the obvious way to build the mask for a /0 produces a mask of all ones instead of all zeros. That case is handled explicitly, which is why /0 correctly reports a mask of 0.0.0.0 and just under 4.3 billion usable addresses rather than a single host.

Reading the report

The output is one plain text block in labelled sections. The input section confirms what was parsed. The netmask section gives the prefix, the dotted mask and the wildcard. The network section gives the network and broadcast addresses. The host section gives the first and last usable address, the usable count and the total count.

Printing the usable count and the total count separately is deliberate. Nearly every argument about subnet sizes comes down to somebody quoting one and somebody else assuming the other, and a /24 being 256 addresses but 254 hosts is exactly the sort of off by two that survives a whiteboard session and fails in production.

The echo of the parsed input at the top earns its place for the same reason. A dotted netmask and a prefix are two ways of saying the same thing, and seeing 255.255.240.0 restated as /20 is often the moment somebody realises they meant /24 and typed one octet wrong. Confirming the interpretation before the arithmetic costs one line and catches the mistake that the arithmetic itself would faithfully carry all the way through.

Neighbouring network tools

For the permissions half of server work rather than the addressing half, chmod Calculator converts between symbolic and octal modes. To identify the vendor behind a hardware address, MAC Address Lookup resolves the prefix.

When you are sizing a link rather than a subnet, Bandwidth Converter moves between bits and bytes per second, and Download Time Calculator turns that into a wait. For the records that make a domain usable once the addressing is settled, Email DNS Generator writes the entries. Everything else is on the dev tools hub.

See it in action

Screenshot of the IP Subnet Calculator tool with the sample input โ€œ192.168.1.0/24โ€
IP Subnet Calculator mid-process: the sample input โ€œ192.168.1.0/24โ€.
Screenshot of the IP Subnet Calculator result screen showing the generated output โ€œ=== INPUT === 192.168.1.0/24 Interpreted as 192.โ€ฆโ€
The finished result: the generated output โ€œ=== INPUT === 192.168.1.0/24 Interpreted as 192.โ€ฆโ€. The download link is a local blob URL โ€” the file never leaves your device.

Frequently asked questions

What input forms does it accept?

Four shapes, all of which people actually type. An address and prefix joined by a slash, such as 192.168.1.10/24. An address and a dotted netmask separated by a space, such as 172.16.5.9 255.255.240.0. An address and a dotted netmask separated by a slash. And an address and a bare prefix number separated by a space. The report repeats how it interpreted your input on its own line so a misread is visible immediately.

Why does a /31 report no network or broadcast address?

Because a two address subnet has neither. RFC 3021 defines the point to point case where both addresses are usable, which is exactly why it exists, and naively subtracting the usual two would report zero usable hosts for a link that plainly works. The calculator special cases /31, and also /32, marking the network and broadcast lines as not applicable and counting both addresses, or the single address, as usable.

What is the wildcard mask for?

It is the bitwise inverse of the subnet mask, and it is what access control lists on Cisco style equipment expect instead of a netmask. A /24 has a netmask of 255.255.255.0 and a wildcard of 0.0.0.255. Getting the two confused is one of the classic sources of a rule that silently matches nothing, so both are printed side by side rather than leaving you to invert one by hand.

Will a mask like 255.0.255.0 work?

No, and it is rejected rather than quietly producing nonsense. A valid subnet mask must have all of its one bits contiguous from the left, so 255.255.240.0 is legal and 255.0.255.0 is not. The check is done against the mask's actual 32 character bit pattern rather than by counting bits, so a pattern with the right number of ones in the wrong places cannot slip through.

What does the reference table at the bottom show?

Twelve common prefixes with their dotted netmask and usable host count, from /8 down to /32. It is a fixed table rather than something recomputed for your input, and it is there because the question that follows a subnet calculation is very often how much bigger or smaller the next size up or down would be. Having /24 through /30 in front of you answers that without a second round trip.

Is the host count usable hosts or total addresses?

Both are shown, on separate lines, because the difference is where people trip up. A /24 has 256 total addresses and 254 usable ones, since the first is the network address and the last is the broadcast address. A /30 has 4 total and 2 usable, which is why point to point links used to be built with /30 before /31 became practical.

Nothing came back and the page shows a generic failure. What is wrong with my input?

The layout replaces the specific reason with one fixed sentence, so you have to narrow it down yourself. The three realistic causes are an octet outside the range 0 to 255, a prefix outside 0 to 32, and a dotted netmask whose bits are not contiguous. Check the address one octet at a time first, since a typo that turns 25 into 255 is by far the most common.

Related tools