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

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

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:

CIDRNetmaskWildcardUsable hosts
/8255.0.0.00.255.255.25516,777,214
/16255.255.0.00.0.255.25565,534
/24255.255.255.00.0.0.255254
/27255.255.255.2240.0.0.3130
/30255.255.255.2520.0.0.32

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:

Common subnetting mistakes

Sources & further reading

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.