Subnet Calculator
Type an IPv4 address with a prefix like /24 or a netmask like 255.255.255.0. You instantly get the network and broadcast addresses, usable host range, masks and a binary view, and you can split the network into smaller subnets.
| IP address | – |
|---|---|
| Host range | – |
| Hex (IP / network) | – |
| Integer (IP) | – |
| Reverse DNS zone | – |
Binary view
network bitshost bits
Split into subnets
| # | Subnet | First host | Last host | Broadcast | Usable hosts |
|---|
How to use the Subnet Calculator
- Enter an IPv4 address with its prefix, for example
192.168.1.10/24, or an address and netmask such as192.168.1.10 255.255.255.0. - Or pick the prefix from the list, which also shows each prefix's netmask and size.
- Press Calculate Subnet (results also update as you type) and read the network, broadcast and host range.
- Check the binary view to see which bits belong to the network (green) and which to hosts (orange).
- Split the network: choose a longer prefix or enter how many hosts each subnet needs, press Split Subnet and download the list as CSV.
Subnet formulas
- Network address = IP AND mask
- Broadcast address = network OR wildcard (wildcard = NOT mask)
- Total addresses = 232 − prefix; usable hosts = total − 2 (except /31 = 2 and /32 = 1)
- First host = network + 1; last host = broadcast − 1
Worked example for 172.16.5.4/20: the mask has 20 one-bits, 255.255.240.0. The third octet 5 is 00000101; AND with 240 (11110000) gives 0, so the network is 172.16.0.0. The wildcard is 0.0.15.255, so the broadcast is 172.16.0.0 OR 0.0.15.255 = 172.16.15.255. There are 212 = 4,096 addresses and 4,094 usable hosts, from 172.16.0.1 to 172.16.15.254.
CIDR prefix reference
| Prefix | Netmask | Wildcard | Addresses | Usable hosts |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 (point-to-point, RFC 3021) |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 (single host) |
Special-purpose IPv4 ranges
| Range | Use |
|---|---|
| 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 | Private networks (RFC 1918), not routed on the internet |
| 100.64.0.0/10 | Carrier-grade NAT shared address space (RFC 6598) |
| 127.0.0.0/8 | Loopback (localhost) |
| 169.254.0.0/16 | Link-local, self-assigned when DHCP fails |
| 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 | Documentation and examples (RFC 5737) |
| 198.18.0.0/15 | Network benchmark testing |
| 224.0.0.0/4 | Multicast |
| 240.0.0.0/4 | Reserved; 255.255.255.255 is the limited broadcast address |
Splitting a network into subnets
Borrowing k host bits creates 2k subnets. Splitting 192.168.1.0/24 into /26 borrows 2 bits and gives 4 subnets of 64 addresses: 192.168.1.0/26, .64/26, .128/26 and .192/26, each with 62 usable hosts. To size a subnet for h hosts, pick the smallest block where 232 − prefix − 2 ≥ h: 50 hosts need a /26 (62 usable), 100 hosts a /25 (126 usable) and 300 hosts a /23 (510 usable).
Frequently asked questions
How do I calculate the network address?
Write the IP address and subnet mask in binary and AND them together. For 192.168.1.10/24 the mask is 255.255.255.0, so the network address is 192.168.1.0. The broadcast address sets all host bits to 1: 192.168.1.255.
How many usable hosts does a subnet have?
A prefix of /n has 2^(32 − n) addresses. Normally the first (network) and last (broadcast) address cannot be assigned, so usable hosts = 2^(32 − n) − 2. A /24 has 256 addresses and 254 usable hosts. /31 and /32 are special cases.
Why does a /31 show 2 usable hosts?
RFC 3021 allows /31 networks on point-to-point links. With only two addresses there is no need for a network or broadcast address, so both are usable hosts. A /32 identifies a single host, for example a loopback interface or a firewall rule.
What is a wildcard mask?
It is the inverse of the subnet mask: each bit is flipped, so 255.255.255.0 becomes 0.0.0.255. Cisco access lists and OSPF network statements use wildcard masks, where a 0 bit means “must match” and a 1 bit means “any value”.
What is the difference between CIDR and a netmask?
They describe the same thing. CIDR notation counts the network bits (/24), while a dotted netmask writes them as four octets (255.255.255.0). A valid netmask always has all 1 bits first, followed by 0 bits.
Which addresses are private?
RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. 100.64.0.0/10 is shared address space for carrier-grade NAT, 127.0.0.0/8 is loopback and 169.254.0.0/16 is link-local. The calculator labels these and other special ranges.
Does this tool support IPv6?
This calculator is for IPv4. To expand or compress IPv6 addresses, use an IPv6 expander and compressor. Everything here is calculated in your browser.