Developer ToolsIPv4 · RFC 1918 aware

IP Subnet Calculator

Give it an address and a prefix length and it tells you where the subnet starts, where it ends, which addresses you can actually assign, and what the mask looks like in binary.

Address & Prefix

Accepts 192.168.1.10 with a prefix below, or 192.168.1.10/24 typed directly.

Dotted quad, optionally with /prefix
/0 to /32
NETWORK
Subnet mask
Wildcard mask
Network address
Broadcast address
First usable host
Last usable host
Total addresses
Usable hosts

Classification

Address scope
Legacy class
Your address is
Next subnet starts at
Address over mask — the boundary is the prefix

What the prefix length actually means

An IPv4 address is 32 bits. The prefix length says how many of those leading bits identify the network; the rest identify the host inside it. A /24 fixes the first 24 bits, leaving 8 host bits, so the subnet contains 28 = 256 addresses. The binary view above shows the boundary directly, which is usually faster than reasoning about the dotted-decimal mask.

Why usable hosts is two fewer than total addresses

The all-zeros host address names the network itself and the all-ones host address is the broadcast address; neither can be assigned to a machine. So a /24 has 256 addresses but 254 usable ones. The exceptions are /31 and /32: RFC 3021 allows a /31 to be used for a point-to-point link with both addresses assigned, and a /32 is a single host route.

Private ranges, and the one that keeps surprising people

RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private use. The middle one catches people out: it is 172.16 through 172.31, not all of 172.x. There is also 100.64.0.0/10 (RFC 6598) for carrier-grade NAT, 169.254.0.0/16 for link-local autoconfiguration — the address your machine assigns itself when DHCP fails — and 127.0.0.0/8 for loopback.

Classes are history, but the vocabulary survives

Classful addressing was replaced by CIDR in 1993. The old class letters are shown above because documentation and interview questions still use them, not because anything routes that way now. “A class C network” is a phrase people use to mean /24; the two have not formally been the same thing for three decades.

Frequently Asked Questions

How many usable hosts are in a /24?
254. The subnet holds 256 addresses, but the network address and the broadcast address cannot be assigned to hosts.
Is 172.20.0.0 a private address?
Yes. The private block is 172.16.0.0/12, which covers 172.16.0.0 through 172.31.255.255. Addresses like 172.32.x.x are public.
What is a wildcard mask for?
It is the bitwise inverse of the subnet mask, used by Cisco access control lists and OSPF. A /24 has a subnet mask of 255.255.255.0 and a wildcard mask of 0.0.0.255.
Can I use a /31 for a link between two routers?
Yes — RFC 3021 defines exactly that case, with both addresses usable. This calculator reports 2 usable hosts for a /31 rather than zero.
Where these numbers come from

Sources

Official publications only. Links open the original document in a new tab.