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.
Classification
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?
Is 172.20.0.0 a private address?
What is a wildcard mask for?
Can I use a /31 for a link between two routers?
Sources
Official publications only. Links open the original document in a new tab.
- Internet Engineering Task Force RFC 1918 — Address allocation for private internets The private IPv4 address blocks
- Internet Engineering Task Force RFC 3021 — Using 31-bit prefixes on IPv4 point-to-point links Using a /31 on point-to-point links