Subnet Calculator

Enter an IPv4 address and a CIDR prefix or netmask to get the network, broadcast, host range, usable count and full binary breakdown - all live.

Network address
-
Broadcast address
-
First usable host
-
Last usable host
-
Usable hosts
-
Total addresses
-
Wildcard mask
-
IP class
-
Address type
-
Binary breakdown
Address
Netmask

The highlighted bits are the network portion (the prefix); the rest identify the host.

CIDR notation explained

An IPv4 address is 32 bits. A subnet mask splits those bits into a network part (the leading 1 bits) and a host part (the trailing 0 bits). CIDR notation just counts the network bits: /24 means the first 24 bits are network, leaving 8 for hosts. Those 8 host bits give 256 total addresses, of which the first (network) and last (broadcast) are reserved, so 254 are usable. Change the prefix above and every value updates live, including the binary view that shows exactly where the split falls.

The /31 and /32 special cases

The "reserve two addresses" rule breaks down at the small end. A /31 has only two addresses; reserving both would leave nothing, so RFC 3021 makes both usable for point-to-point links, with no broadcast. A /32 is a single host - network and host collapse into one address, used for loopbacks and single-machine firewall rules. This calculator applies both rules, so a /31 reports 2 usable hosts and a /32 reports 1.

Common subnet sizes

Prefix Netmask Total Usable hosts
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/30255.255.255.25242

Working with addresses in other bases? The binary converter turns each octet into bits by hand, and what is my IP shows your own public address to test against these ranges.

Frequently asked questions

How many usable hosts are in a /24?
A /24 has 256 total addresses. The first is the network address and the last is the broadcast address, neither of which can be assigned to a host, leaving 254 usable. The general rule for a prefix of 30 or shorter is 2 to the power of (32 minus the prefix), minus 2.
Why does a /31 have 2 usable hosts and no broadcast?
A /31 has only two addresses. Normally both would be reserved as network and broadcast, leaving zero usable, which is useless. RFC 3021 redefines a /31 for point-to-point links so that both addresses are usable hosts and there is no separate broadcast. That is exactly what you want for a link between two routers.
Why does a /32 have only 1 host?
A /32 is a single address with a full 32-bit mask, so the network and the host are the same one address. It represents exactly one machine and is commonly used for loopbacks, host routes and firewall rules that target a single IP.
What is the difference between a netmask and a CIDR prefix?
They express the same thing two ways. The CIDR prefix (like /26) is the number of leading 1 bits in the mask. The dotted netmask (like 255.255.255.192) writes those same bits out as four octets. /26 and 255.255.255.192 are identical; this tool keeps the two in sync.
What makes an IP address private?
Private ranges are reserved by RFC 1918 for internal networks and are never routed on the public internet: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Also special are 127.0.0.0/8 (loopback), 169.254.0.0/16 (link-local) and 100.64.0.0/10 (carrier-grade NAT). Everything else is public.