Subnet Calculator
Work out the network address, broadcast address, usable host range and host count from an IP and prefix length.
Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.
What the Subnet Calculator does
The subnet calculator on this page will work out the network address, broadcast address, usable host range and host count from an IP and prefix length. Fill in all 5 fields and the result updates as you type — there is no Calculate button to press and no page reload. It is most often used for planning an IP addressing scheme. Companion tools to this one live on FreeToolsWorld.org.
How to use it
- Enter the four octets of any address in the subnet.
- Enter the prefix length — the number after the slash.
- Read the network and broadcast addresses and the usable host range.
How it works
The prefix length says how many leading bits identify the network, and the rest identify the host. A /24 leaves eight host bits, giving 256 addresses of which 254 are usable — the first is the network address and the last is the broadcast address, and neither can be assigned to a device.
That minus two is why small subnets get wasteful fast. A /30 has four addresses and two usable hosts, which is the classic point-to-point link. A /31 is a special case defined by RFC 3021: it has two addresses and both are usable, specifically for point-to-point links where no broadcast is needed. A /32 is a single host route.
The private ranges from RFC 1918 — 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 — are not routed on the public internet. The 172.16 range is the one people get wrong: it covers 172.16 through 172.31, not all of 172.x.
An address of 169.254.x.x means the device failed to get a DHCP lease and self-assigned a link-local address. Seeing one is a diagnosis, not a configuration.
When to use it
- Planning an IP addressing scheme.
- Working out whether two addresses are in the same subnet.
- Converting between a subnet mask and a prefix length.
- Checking the usable host range before assigning static addresses.
Common mistakes to avoid
- Assigning the network or broadcast address to a device.
- Assuming all of 172.x is private. Only 172.16 through 172.31 are.
- Forgetting that a /30 gives only two usable hosts.
Frequently asked questions
How many hosts are in a /24?
254 usable. A /24 has 256 addresses, minus the network address and the broadcast address.
What is a /31 used for?
Point-to-point links. RFC 3021 allows both addresses in a /31 to be used as hosts, because a point-to-point link needs no broadcast address.
Which IP ranges are private?
10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 under RFC 1918. Note that the 172 range covers 172.16 to 172.31 only.