IP Subnet Calculator
What's my subnet? Enter an IPv4 address and CIDR prefix (or netmask) to see the network, broadcast, and usable host range instantly.
Enter a prefix length from 0–32, or a dotted netmask like 255.255.255.0
Enter an IPv4 address and prefix to see the subnet breakdown
Tap a card to copy the value
Binary view
CIDR quick-reference table (/0 – /32)
| Prefix | Netmask | Wildcard | Total addresses | Usable hosts |
|---|
How IPv4 subnetting actually works
Every IPv4 address is 32 bits, usually written as four decimal octets separated by dots, like 192.168.1.10. A CIDR prefix — the /24 in 192.168.1.10/24 — splits those 32 bits into two parts: a network portion (shared by every device on the subnet) and a host portion (unique to each device). This subnet calculator takes an address and a prefix or netmask, does the bitwise math instantly, and shows you exactly where that split lands.
What each result means
- Network address — the address with every host bit set to 0. It identifies the subnet itself and is never assigned to a device.
- Broadcast address — the address with every host bit set to 1. Traffic sent here is meant for every host on the subnet, so it's also never assigned to a single device.
- First / last usable host — the network address plus one, through the broadcast address minus one. This is the actual range you can hand out to routers, servers, or workstations.
- Usable hosts — how many addresses fall in that assignable range:
2^(32 − prefix) − 2for ordinary subnets. - Netmask and wildcard mask — the same boundary expressed as a dotted-decimal mask (netmask) or its bitwise inverse (wildcard mask, used by tools like Cisco access lists).
Example — a typical office subnet. 192.168.1.10/24 has a 24-bit network portion and an 8-bit host portion. Network address 192.168.1.0, broadcast 192.168.1.255, usable range 192.168.1.1 – 192.168.1.254 (254 hosts), netmask 255.255.255.0.
Example — a smaller subnet for a VLAN. 192.168.1.10/26 only reserves the last 6 bits for hosts: network 192.168.1.0, broadcast 192.168.1.63, usable range 192.168.1.1 – 192.168.1.62 (62 hosts) — 4 subnets of this size fit inside the original /24.
Example — a router link. 10.0.0.0/31 is a 2-address point-to-point link (RFC 3021): both 10.0.0.0 and 10.0.0.1 are usable host addresses, and neither is a network or broadcast address — this is the standard way to number a link between two routers without wasting a /30's worth of addresses.
CIDR prefix, netmask, and wildcard mask side by side
A handful of prefixes come up constantly when subnetting a network — this is a shorter version of the full /8–/32 table above the fold:
| CIDR | Netmask | Wildcard | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,214 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,534 |
| /24 | 255.255.255.0 | 0.0.0.255 | 254 |
| /27 | 255.255.255.224 | 0.0.0.31 | 30 |
| /30 | 255.255.255.252 | 0.0.0.3 | 2 |
Why /31 and /32 don't follow the usual formula
The standard "usable = total − 2" rule assumes a network needs one address reserved for the network itself and one for broadcast. Two RFCs carve out exceptions that this calculator handles automatically:
- /31 (RFC 3021): a point-to-point link only ever has two endpoints, so both addresses are usable and neither is reserved — this is the modern standard for router-to-router and other WAN links, replacing the older habit of burning a full /30 on a 2-host link.
- /32: a route to exactly one host, common for loopback interfaces and static host routes. The single address is simultaneously its own network, its own broadcast, and its only usable host.
Common subnetting mistakes
- Confusing the network address with a usable host:
192.168.1.0/24's network address (192.168.1.0) can't be assigned to a device — the first usable host is192.168.1.1. - Assuming every mask is a valid netmask: a netmask's 1 bits must be contiguous from the left (like
255.255.255.192); something like255.255.255.64is not a valid netmask, and this calculator flags it rather than guessing what you meant. - Forgetting the /31 and /32 exceptions: applying the "minus 2" formula to a /31 or /32 undercounts the usable addresses — see the section above for why those two prefixes behave differently.
Sources & further reading
- RFC 4632 (RFC Editor) — Classless Inter-Domain Routing (CIDR) address assignment and aggregation
- RFC 1918 (RFC Editor) — address allocation for private internets (10/8, 172.16/12, 192.168/16)
- RFC 3021 (RFC Editor) — using /31 prefixes on point-to-point links
- NIST Publications — network and IP addressing security guidance
Frequently asked questions
What is a CIDR prefix and how does it relate to a subnet mask?
A CIDR prefix like /24 counts how many leading bits of the 32-bit IPv4 address are reserved for the network portion — the rest identify hosts within that network. /24 means the first 24 bits are network bits, which converts to the dotted netmask 255.255.255.0. A smaller prefix like /16 covers more addresses (a bigger network, fewer host bits reserved for the network), while a larger prefix like /28 covers fewer addresses. This subnet calculator accepts either form — type 24 or 255.255.255.0 — and converts between them automatically.
How do I calculate the number of usable hosts in a subnet?
The formula is 2 raised to the number of host bits, minus 2: usable hosts = 2^(32 − prefix) − 2. The minus 2 removes the network address (all host bits 0) and the broadcast address (all host bits 1), which can't be assigned to a device. For example, a /26 subnet has 6 host bits, so 2^6 − 2 = 62 usable addresses. A /24 has 8 host bits, giving 2^8 − 2 = 254 usable addresses. This calculator applies the formula automatically and also handles the /31 and /32 exceptions described below.
Why do /31 and /32 subnets have no broadcast address?
The 2-address-minimum rule assumes a network needs a network address and a broadcast address, leaving the rest for hosts. RFC 3021 makes an exception for /31: since a point-to-point link (like a router-to-router connection) only ever has two endpoints, both addresses are treated as usable and neither is reserved. A /32 is a route to a single specific host — commonly used for loopback interfaces or host routes — so the one address is simultaneously its own network, broadcast, and usable address. This calculator detects both cases and adjusts the usable host count and address range accordingly instead of showing a network/broadcast split that wouldn't apply.
How do I convert a subnet mask like 255.255.255.0 into a CIDR prefix?
Count the number of 1 bits in the mask's binary form, from the left. 255.255.255.0 in binary is 11111111.11111111.11111111.00000000 — 24 ones followed by 8 zeros — so it's a /24. A valid netmask always has its 1 bits contiguous starting from the left with no gaps; if you type a mask that doesn't follow that pattern, this calculator flags it as invalid rather than guessing. Type the dotted netmask directly into the prefix field and the CIDR number appears automatically alongside the rest of the subnet breakdown.
Is my IP address sent to a server when I use this calculator?
No. Every calculation — parsing the address, deriving the netmask, computing the network, broadcast and usable range — runs locally in your browser's JavaScript. Nothing you type is uploaded, logged, or stored anywhere except your own browser's localStorage (used only to remember your last input for next time). You can look up private or internal network ranges with this subnet calculator without exposing them to the network.