Subnet divider: split a block into subnets
Enter an IPv4 block in CIDR form and say how to divide it: into a number of subnets, or into subnets that each hold a number of hosts. You get the new prefix length, how many subnets come out, how many hosts each holds and a list of every subnet with its range and broadcast address.
Example: 192.168.0.0/24 makes 4 subnets of /26
Each one holds 64 addresses, 62 of them usable, with the mask 255.255.255.192.
This is address arithmetic from the IPv4 and IPv6 standards. It shows how a block divides up; it does not plan, configure or protect a network.
All 4 subnets
| # | Subnet | First usable | Last usable | Broadcast |
|---|---|---|---|---|
| 1 | 192.168.0.0/26 | 192.168.0.1 | 192.168.0.62 | 192.168.0.63 |
| 2 | 192.168.0.64/26 | 192.168.0.65 | 192.168.0.126 | 192.168.0.127 |
| 3 | 192.168.0.128/26 | 192.168.0.129 | 192.168.0.190 | 192.168.0.191 |
| 4 | 192.168.0.192/26 | 192.168.0.193 | 192.168.0.254 | 192.168.0.255 |
The formula, with a worked example
- By number of subnets N: borrow b bits, the smallest b with 2^b ≥ N. New prefix = old prefix + b.
- By hosts per subnet H: the new prefix is the longest one with 2^(32 − prefix) − 2 ≥ H (a /31 counts 2 and a /32 counts 1).
- Subnets made = 2^(new prefix − old prefix). Each one holds 2^(32 − new prefix) addresses.
- Subnet k starts at the block's network address + k × 2^(32 − new prefix).
- Worked example: 192.168.0.0/24 into 4 subnets borrows 2 bits (2^2 = 4), so the new prefix is /26: 4 subnets of 64 addresses, 62 usable hosts each, starting at .0, .64, .128 and .192.
Dividing by number of subnets
Splitting a block means moving the prefix to the right. Every bit you move it, which is called borrowing a bit from the host part, doubles the number of subnets and halves the size of each one. To get N subnets you borrow the smallest number of bits b that gives at least N, that is 2^b ≥ N.
For 4 subnets that is 2 bits, since 2^2 = 4. For 5 subnets 2 bits is not enough (only 4), so it takes 3 bits and you get 8 subnets. Subnets always come in powers of two when every one is the same size, so asking for 5 gives 8, and the extra 3 are spare. The divider says when it has rounded up like this.
Take 192.168.0.0/24 into 5. Borrowing 3 bits makes it a /27, so there are 8 subnets of 32 addresses each, 30 usable hosts in each. They start at .0, .32, .64, .96, .128, .160, .192 and .224.
Dividing by hosts per subnet
When the size of each subnet matters more than the count, divide by hosts instead. The divider finds the smallest subnet that still holds the number of hosts you enter, which is the longest prefix where 2^(32 − prefix) − 2 is at least that number, and then fits as many of those into the block as it can.
For 50 hosts in 192.168.10.0/24, a /27 gives 30 usable hosts, which is too few, and a /26 gives 62, which is enough. So the block splits into 4 subnets of /26. The second of them runs from 192.168.10.64 to 192.168.10.127, with usable hosts .65 to .126.
For 500 hosts in 10.0.0.0/16, a /24 gives 254 (too few) and a /23 gives 510, so the block makes 128 subnets of /23. The second one is 10.0.2.0/23, with a broadcast address of 10.0.3.255.
Reading the list of subnets
Each row is one subnet: its network address in CIDR form, its first and last usable host and its broadcast address. The subnets are back to back, so each network address is the previous broadcast address plus one. The list shows up to the first 64 subnets; the count and size above it always cover the whole split, and any subnet further down can be found by adding the block size.
To find subnet number k (counting from 0), multiply k by the subnet size and add it to the block's network address. With /26 subnets of 64 addresses, subnet 3 of 192.168.0.0/24 starts at 192.168.0.0 + 3 × 64 = 192.168.0.192.
Edge cases and limits
If you enter an address that is not the start of the block, such as 192.168.0.77/24, the divider uses the block it belongs to, 192.168.0.0/24. A block cannot be split past /32, so asking for more subnets than the block has addresses is an error, as is asking for more hosts than the whole block can hold.
Dividing down to /31 gives subnets of 2 addresses that count 2 usable each under RFC 3021, and dividing down to /32 gives single addresses. Asking for 2 hosts per subnet picks /31 for that reason, and asking for 1 picks /32.
This tool makes equal-sized subnets. Variable length subnet masking (VLSM) mixes sizes inside one block; you can do that by dividing the block once, then dividing one of the resulting subnets again here.
Reference: subnet sizes from /16 to /32
| Prefix | Subnet mask | Wildcard | Total addresses | Usable hosts |
|---|---|---|---|---|
| /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 |
Frequently asked questions
How do I divide a /24 into 4 subnets?
Borrow 2 bits, since 2^2 = 4. The new prefix is /26, giving 4 subnets of 64 addresses and 62 usable hosts each: .0/26, .64/26, .128/26 and .192/26.
How many /26 subnets are in a /24?
4. The prefix moves 2 bits, and 2^2 = 4.
How many /30 subnets are in a /24?
64. The prefix moves 6 bits, and 2^6 = 64. Each /30 has 2 usable hosts.
Why did I get more subnets than I asked for?
Equal-sized subnets come in powers of two. If you ask for a number that is not a power of two, such as 5, the divider rounds up to the next one, 8, and the extra subnets are spare.
What prefix do I need for 100 hosts?
A /25. It holds 128 addresses, 126 usable. A /26 holds only 62 usable hosts, which is too few.
What is VLSM?
Variable length subnet masking: splitting one block into subnets of different sizes. You can work it out here by dividing a block, then dividing one of its subnets again with a longer prefix.
To see every prefix size side by side, the subnet cheat sheet lists /0 to /32 with masks and host counts. Subnet cheat sheet (CIDR chart)
Other subnet tools on this site
-
IPv4 subnet calculator
Network, broadcast, host range, mask, wildcard and host count for any IPv4 address and prefix.
-
IPv6 subnet calculator
Network prefix, address range, total addresses and the number of /64 subnets in any IPv6 prefix.
-
Subnet cheat sheet (CIDR chart)
Every IPv4 prefix from /0 to /32 with its subnet mask, wildcard, total addresses and usable hosts.