How to use the subnet calculator
Enter an IPv4 or IPv6 address and choose a prefix length, or paste a network in CIDR notation such as 10.0.0.0/8. The results update as you type: the subnet mask and wildcard, the network and broadcast addresses, the usable host range, a binary breakdown, the address class and what kind of range the address belongs to. The address bar always holds a link to your current calculation, so you can share it.
What a subnet mask and CIDR prefix mean
A prefix length such as /24 says that the first 24 bits of an address identify the network and the remaining bits identify hosts on it. The subnet mask 255.255.255.0 is simply those 24 one-bits written in dotted decimal; the wildcard mask is its inverse. An IPv4 block with a prefix of p contains 232 − p addresses, so a /24 holds 256. Classless Inter-Domain Routing (RFC 4632) replaced the old fixed classes with prefixes of any length.
Usable hosts, /31 and /32
In an ordinary IPv4 subnet the first address is the network address and the last is the broadcast address, so neither can be given to a host: usable hosts are the total minus two. Two prefixes are special. A /31 is a point-to-point link where both addresses are usable (RFC 3021), and a /32 is a single host.
Classful addressing, subnetting and supernetting
Before CIDR, addresses were grouped into classes A to E by their leading bits. The class is still a handy way to learn the numbers, so the calculator shows how your prefix compares with the class default: a longer prefix borrows host bits to make smaller subnets, and a shorter prefix aggregates networks into a supernet.
Public vs private IP addresses
Every device on a network needs an address. Some addresses are public: unique across the whole internet. Others are private: reserved for use inside one network, and reused by millions of networks at once. Knowing which is which explains why your home devices can share one internet connection, why you cannot reach a friend's laptop by its 192.168 address, and why planning a network takes care.
Public addresses
A public address is assigned to an internet provider or organization by a regional registry, so no one else uses it. Anyone on the internet can try to reach it (a firewall decides whether they succeed). When you visit a website, it sees your public address, which usually belongs to your internet provider and is shared by every device in your home. You can see yours on the home page.
Private addresses
Three blocks were set aside in RFC 1918 for private use. Routers on the public internet do not forward traffic to or from them, so the same private address can exist in many networks without conflict.
| Block | Covers | Addresses | Often used for |
|---|---|---|---|
| 10.0.0.0/8 | 10.0.0.0 to 10.255.255.255 | 16,777,216 | Companies and cloud networks |
| 172.16.0.0/12 | 172.16.0.0 to 172.31.255.255 | 1,048,576 | Mid-sized networks and Docker's defaults |
| 192.168.0.0/16 | 192.168.0.0 to 192.168.255.255 | 65,536 | Home and small-office routers |
Notice the middle block: it is 172.16 to 172.31 only. 172.15.x.x and 172.32.x.x are public. That narrow range is the most common source of mix-ups.
How private devices reach the internet
A private address cannot talk to the internet directly. Your router uses network address translation (NAT): it swaps each device's private address for the router's one public address on the way out, and swaps it back on the way in. That is why a whole household appears online as a single address, and why outside machines cannot start a conversation with a device behind the router unless you set up port forwarding.
Other reserved ranges
Some addresses are neither public nor the private ranges you choose yourself:
- 100.64.0.0/10: shared address space that internet providers use between their customers and their own equipment (carrier-grade NAT).
- 169.254.0.0/16: link-local. A device gives itself one of these when it cannot get an address, and it only works on that one link.
- 127.0.0.0/8: loopback, meaning “this device”. 127.0.0.1 is localhost.
- 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24: reserved for examples in documentation, never for real use.
- 224.0.0.0/4 and 240.0.0.0/4: multicast (one sender, many receivers) and addresses held in reserve.
IPv6
IPv6 has so many addresses that it does not need NAT. The nearest thing to a private range is fc00::/7 (unique local addresses, in practice starting fd), meant for use inside one organization. Link-local addresses start fe80::/10, and public addresses are in 2000::/3. Private does not mean protected: what blocks outside traffic is a firewall, not the address.
Why a subnet can be “partly private”
A subnet is a whole range of addresses, not just the one you type. The calculator checks every address in the range. Take 172.20.1.1/8: the address itself is private, but a /8 starts at 172.0.0.0 and ends at 172.255.255.255, and only 172.16 to 172.31 of that is private. About 94% of it is public. Compare 172.20.1.1/16, which stays inside the private block and is entirely private. The same happens with 192.168.1.1/8 and 10.5.5.5/7.
To stay private, start from an address inside the block and use a prefix at least as long as the block: /8 or longer inside 10.x, /12 or longer for 172.16 to 172.31, and /16 or longer inside 192.168.
Mistakes this prevents
- Using a public range inside a private network. Devices then cannot reach the real owner of those addresses.
- Two networks that use the same private range cannot be joined over a VPN without renumbering one of them.
- Assuming a subnet is safe to expose, or safe to ignore, because its first address looks private.
IPv6 subnets
IPv6 addresses are 128 bits long, so the numbers get very large; the calculator uses exact arithmetic and shows the full count. IPv6 has no broadcast address. A /64 is the standard size for a single LAN, a /127 is used for links between two routers (RFC 6164), and a /128 is a single address. The first and last address of the block are shown, along with the fully expanded form.