How to use the IP subnet calculator
- Choose IPv4 or IPv6.
- Enter the IP address. For IPv4 you can type the prefix straight after it (10.0.0.1/24) or a mask after a space (10.0.0.1 255.255.255.0).
- Pick the prefix length. The list shows the matching subnet mask beside each one.
- Optionally enter a number of subnets to split the network into equal blocks.
- Read the network address, host range, broadcast address and masks, then the binary view and the subnet table.
How a subnet is calculated
An IPv4 address is 32 bits. The prefix length says how many of those bits, counted from the left, identify the network. The rest identify a host on that network.
The first address in a block names the network and the last is the broadcast address, so neither can be given to a device. A /31 is the exception: RFC 3021 lets both addresses be used on a point-to-point link between two routers. A /32 is a single host.
Worked example
The calculator starts with 192.168.10.75/26:
- A /26 mask is 26 ones and 6 zeros: 11111111.11111111.11111111.11000000, which is 255.255.255.192.
- Only the last octet is split. 75 in binary is 01001011. AND it with 11000000 and you get 01000000, which is 64.
- Network address: 192.168.10.64/26.
- Wildcard mask: 0.0.0.63. Broadcast: 64 + 63 = 127, so 192.168.10.127.
- The block holds 2^6 = 64 addresses. Take away the network and broadcast addresses and 62 are usable, from 192.168.10.65 to 192.168.10.126.
- 192.168.10.75 falls in the 192.168.0.0/16 block, so it's a private address (RFC 1918). Its first octet puts it in old class C.
Enter 4 in the split box and the /26 becomes four /28 subnets, each with 14 usable hosts: 192.168.10.64, .80, .96 and .112.
Common IPv4 prefix lengths
| Prefix | Subnet mask | Addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
Each step of one bit halves the block. To fit a given number of devices, pick the smallest block whose usable hosts cover them with room to grow.
Private and special addresses
Three ranges are set aside for private networks by RFC 1918: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Routers on the public internet don't forward them, so home and office networks reuse them behind NAT. The calculator also flags loopback (127.0.0.0/8), link-local (169.254.0.0/16), carrier-grade NAT space (100.64.0.0/10), multicast and the documentation ranges. Anything else is shown as public.
Frequently asked questions
What is the difference between a subnet mask and a prefix length?
They describe the same thing two ways. The prefix length counts the network bits, and the mask writes those bits out as four decimal numbers. /24 and 255.255.255.0 are identical.
Why are two addresses in every subnet unusable?
The all-zeros host address identifies the network itself and the all-ones address is the broadcast address for every device on it. Routers and hosts reserve both, so a /24 has 256 addresses but only 254 for devices.
What is a wildcard mask used for?
It is the subnet mask with every bit flipped, so 255.255.255.192 becomes 0.0.0.63. Cisco access lists and OSPF configuration use wildcard masks, where a 0 bit means "must match" and a 1 bit means "any value".
How does the IPv6 mode work?
IPv6 addresses have 128 bits written as eight groups of four hex digits. The calculator expands and shortens the address using the RFC 5952 rules, then zeroes the bits after the prefix to find the network. The default 2001:0db8:abcd:0012:0000:0000:0000:0001 with a /64 shortens to 2001:db8:abcd:121 and sits in the network 2001:db8:abcd:12/64. IPv6 has no broadcast address, so every address in the range can be assigned.
Related calculators
- Bandwidth Calculator — How long a download or upload takes, how much data a connection moves, and a website's monthly bandwidth.
- Binary Calculator — Add, subtract, multiply and divide binary numbers, run AND, OR, XOR and NOT, and convert binary, octal, decimal and hex.
- Hex Calculator — Hexadecimal arithmetic, hex to decimal and binary conversion, and two's complement for 8, 16, 32 and 64-bit numbers.
Results are calculated in your browser. Double-check anything important before you rely on it. See our disclaimer.