Subnet Calculator
Calculate IP subnet masks, network addresses, and host ranges
Network Configuration
Overview
The Subnet Calculator works out the key details of an IPv4 network from an IP address and a CIDR prefix length. It shows the subnet mask, wildcard mask, network and broadcast addresses, first and last usable host, total addresses and usable hosts, plus the address class, whether the address is private, public or special-purpose, and the address and mask in binary.
The method is bitwise. A /26 prefix means the first 26 of the 32 bits identify the network, giving the mask 255.255.255.192. The network address is the IP AND the mask, and the broadcast address sets all remaining host bits to 1. The block contains 2^(32 − prefix) addresses; normally the network and broadcast addresses are reserved, so usable hosts = total − 2. The calculator follows RFC 3021 for /31 point-to-point links (2 usable addresses) and treats /32 as a single host.
Private ranges are identified using RFC 1918 (10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16), and loopback, link-local, carrier-grade NAT, multicast and reserved ranges are labeled separately. The tool handles IPv4 only.
How to Use
- Type an IPv4 address in dotted-decimal form, such as 192.168.1.0, in the IP Address field.
- Drag the CIDR Notation slider from /0 to /32. The label under the slider shows the matching subnet mask, for example /24 = 255.255.255.0.
- Click Calculate Subnet.
- Read the Network Information panel (mask, network, broadcast, wildcard and class) and the Host Information panel (first and last usable host, total addresses, usable hosts and network type).
- Use the Binary Representation to see exactly which bits belong to the network, and the Common CIDR Notations table for quick reference.
Frequently Asked Questions
How do I calculate the network and broadcast address?
Take 192.168.10.77/26. A /26 mask is 255.255.255.192, so each block holds 64 addresses (256 − 192). The last octet 77 falls in the block that starts at 64, giving a network address of 192.168.10.64 and a broadcast address of 192.168.10.127. Usable hosts run from 192.168.10.65 to 192.168.10.126, which is 62 hosts, and the wildcard mask is 0.0.0.63.
How many usable hosts are in a /24 subnet?
A /24 has 8 host bits, so it contains 2⁸ = 256 addresses. Subtract the network address and the broadcast address and you get 254 usable hosts. Each extra prefix bit halves the block: a /25 has 126 usable hosts, a /26 has 62, a /27 has 30, a /28 has 14 and a /30 has 2. Going the other way, a /23 has 510 and a /16 has 65,534.
What is the difference between a subnet mask and CIDR notation?
They describe the same thing in different forms. A subnet mask writes the network bits as four decimal octets, such as 255.255.255.0, while CIDR notation, defined in RFC 4632, simply counts the 1 bits after a slash, so 255.255.255.0 is /24. CIDR is shorter and supports any prefix length, which replaced the old fixed Class A, B and C network sizes.
What is a wildcard mask used for?
A wildcard mask is the inverse of the subnet mask: every 1 bit becomes 0 and every 0 becomes 1. For a /24 it is 0.0.0.255, and for a /26 it is 0.0.0.63. Network equipment uses wildcard masks in access control lists and in routing protocols such as OSPF to say which bits of an address must match (0) and which can be anything (1).
Why does a /31 subnet have two usable hosts?
Traditionally the first and last address in every subnet are reserved for the network and broadcast addresses, which would leave a /31 with zero usable hosts. RFC 3021 allows both addresses of a /31 to be used on point-to-point links, where broadcast is not needed, saving address space between routers. This calculator follows that rule, and treats a /32 as a single host address.
How do I know if an IP address is private?
RFC 1918 reserves three ranges for private networks: 10.0.0.0 to 10.255.255.255, 172.16.0.0 to 172.31.255.255 and 192.168.0.0 to 192.168.255.255. These addresses are not routed on the public internet and are reached through NAT. The calculator also flags special ranges such as 127.0.0.0/8 loopback, 169.254.0.0/16 link-local and 100.64.0.0/10 shared address space used by carrier-grade NAT.