Subnetting comes up in a network engineer's life almost every day: planning a new VLAN, reading a firewall rule, checking why two hosts cannot see each other, or carving a block into links and server networks. The arithmetic is simple, but it is easy to slip by one bit under pressure. This page does the calculation instantly for IPv4 and IPv6, splits networks, plans VLSM allocations, and shows the binary behind every answer so you can check your own working instead of just copying a result.
IPv4 calculator
Type an address with a prefix (10.20.30.40/22), with a mask (10.20.30.40 255.255.252.0) or with a wildcard (10.20.30.40 0.0.3.255). Drag the slider, or click any bit below, to move the boundary between network and host.
Split a network
Divide the network above into equal, smaller subnets. The subnet that contains your address is highlighted.
| # | Network | Usable range | Broadcast | Hosts |
|---|
VLSM planner
Variable-length subnet masking gives each segment only the space it needs. List the segments and how many hosts each must hold; the planner allocates the largest first so every subnet stays aligned on its boundary, and shows how much of the block is left.
| Segment | Needs | Subnet | Usable range | Broadcast | Usable | Spare |
|---|
IPv6 calculator
IPv6 subnetting is mostly about prefixes on nibble (4-bit) boundaries: a site often receives a /48, every LAN gets a /64. Enter any IPv6 address with a prefix; shortened forms and embedded IPv4 (::ffff:192.0.2.1) are accepted.
How subnetting works
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 subnet mask is the same thing written as an address: ones for network bits, zeros for host bits. A /26 is 26 ones followed by 6 zeros, which is 255.255.255.192.
To find the network, the device performs a bitwise AND of the address and the mask: every host bit is forced to zero. Setting every host bit to one instead gives the broadcast address. Everything in between is usable for hosts, so a subnet with h host bits holds 2h addresses and 2h − 2 usable hosts.
The block-size shortcut
You rarely need the binary in your head. Find the octet where the mask is neither 255 nor 0 (the “interesting” octet) and subtract its value from 256: that is the block size, and networks start at every multiple of it. For 192.168.10.37/26 the mask is 255.255.255.192, the block size is 256 − 192 = 64, so the networks in the last octet are .0, .64, .128 and .192. The address .37 falls in the first one: network 192.168.10.0, broadcast 192.168.10.63, hosts .1 to .62.
Wildcard masks
Access lists and OSPF network statements on many platforms use a wildcard mask, the inverse of the subnet mask: zeros mean “must match”, ones mean “any value”. The wildcard for 255.255.255.192 is 0.0.0.63. Subtract each octet of the mask from 255 to get it, or let the calculator above do it.
Cheat sheet
Every prefix from /8 to /32 with its mask, wildcard and size.
| Prefix | Subnet mask | Wildcard | Addresses | Usable hosts |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 |
| /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 |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
Special-purpose ranges
Ranges the calculator recognises and labels, with the RFC that defines each one.
| Range | Purpose | Defined in |
|---|---|---|
0.0.0.0/8 | “This network” | RFC 791 |
10.0.0.0/8 | Private | RFC 1918 |
100.64.0.0/10 | Shared address space (carrier-grade NAT) | RFC 6598 |
127.0.0.0/8 | Loopback | RFC 1122 |
169.254.0.0/16 | Link-local (APIPA) | RFC 3927 |
172.16.0.0/12 | Private | RFC 1918 |
192.0.0.0/24 | IETF protocol assignments | RFC 6890 |
192.0.2.0/24 | Documentation (TEST-NET-1) | RFC 5737 |
192.168.0.0/16 | Private | RFC 1918 |
198.18.0.0/15 | Benchmarking | RFC 2544 |
198.51.100.0/24 | Documentation (TEST-NET-2) | RFC 5737 |
203.0.113.0/24 | Documentation (TEST-NET-3) | RFC 5737 |
224.0.0.0/4 | Multicast | RFC 5771 |
240.0.0.0/4 | Reserved | RFC 1112 |
255.255.255.255/32 | Limited broadcast | RFC 919 |
fe80::/10 | IPv6 link-local | RFC 4291 |
fc00::/7 | IPv6 unique local (ULA) | RFC 4193 |
2001:db8::/32 | IPv6 documentation | RFC 3849 |
ff00::/8 | IPv6 multicast | RFC 4291 |
The calculator runs entirely in your browser; nothing you type is sent anywhere.