Skip to content

Subnetting Guide

Last updated: October 9, 2026

Subnetting is how you cut one IPv4 block into smaller ones. You either cut it into equal pieces, or you size each piece to the number of hosts that LAN actually needs. Both start from the same two facts: the prefix says where the network bits end, and a normal subnet holds back its first and last address.

The numbers below come from the same functions the calculators use. Change a prefix or a host count and the worked example moves with you.

  1. 01

    What is a subnet?

    A subnet is one contiguous run of addresses. Devices in the same subnet share a prefix and can exchange packets without a router hop between them. The prefix length is the boundary: bits to the left name the network, bits to the right name the host.

    Devices in that run share a prefix, so a switch can deliver a frame without asking a router. An address with a different prefix is a different subnet, even when the first three octets look familiar. 192.168.10.20/26 and 192.168.10.70/26 share a text prefix of 192.168.10 and still sit in different blocks, because a /26 steps by 64.

    You subnet for a reason: a broadcast stays inside the LAN, a firewall rule can name one group, and a router knows which interfaces are local. The arithmetic is only there to make those boundaries land on real addresses.

  2. 02

    Understanding CIDR notation

    CIDR writes the prefix as a slash length. 10.1.2.3/16 does not mean the block is only 10.1.2.3. The /16 keeps the first two octets and clears the rest, so the network is 10.1.0.0 and the block runs through 10.1.255.255.

    Read the slash as a count of network bits. A longer prefix is a smaller subnet. Borrowing one bit from the host side doubles the number of equal subnets and halves the addresses in each. That trade is the whole of equal-size subnetting. Notation, masks, and the /31 exception are written out on the CIDR guide.

  3. 03

    How to calculate subnets

    Start with the address and the prefix. Build the mask as that many 1 bits. The network is address AND mask. The broadcast is network OR the inverse of the mask. For /0 through /30, usable hosts sit strictly between those two ends.

    For one address, the steps are always the same:

    1. Host bits are 32 minus the prefix. Total addresses are 2 to that power.
    2. The mask is that many 1 bits, written as dotted decimal.
    3. The network is the address AND the mask. Host bits become 0.
    4. The broadcast is the network with the host bits set to 1.
    5. For /0 through /30, usable hosts sit strictly between those two ends.

    The block size is the total, and it is also the gap between legal network numbers. When the prefix falls inside the last octet, the block size is 256 minus that mask octet. A /27 mask ends in 224, and 256 minus 224 is 32. Networks of that size end in a multiple of 32.

Worked example: 192.168.10.42/27

Five host bits remain, so the block holds 32 addresses and 30 usable hosts. The last octet of 42 is not a multiple of 32. The multiple at or below 42 is 32, so 42 sits in the block that starts at 32.

Network 192.168.10.32. Broadcast 192.168.10.63. Mask 255.255.255.224. Usable hosts 192.168.10.33 through 192.168.10.62. The next network of the same size would start at 192.168.10.64.

Try the same address in the subnet calculator, or read every prefix in the CIDR reference.

192.168.10.42/27
mask      255.255.255.224
network   192.168.10.32
broadcast 192.168.10.63
usable    192.168.10.33 - 192.168.10.62
Prefix sizes from /24 through /32
PrefixMaskBlock sizeUsable hosts
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/31255.255.255.25422
/32255.255.255.25511

/31 and /32 are in the table on purpose. Their usable counts are not block size minus 2.

Split a block into equal subnets

Borrow bits when every child should be the same size. The new prefix is the parent prefix plus the bits you borrow. Two borrowed bits make four children. Three make eight. You cannot ask for three equal subnets. The counts only come in powers of two, so a request for three rounds up to four, and one child is spare.

192.168.10.0/24 cut to /26 borrows 2 bits and produces 4 blocks. Each holds 64 addresses and 62 usable hosts. The children cover the parent once: 4 times 64 is 256, the size of the /24. Usable hosts do not add back to 254, because every child spends two addresses on its own network and broadcast.

192.168.10.0/24 divided into /26 subnets
SubnetUsable rangeBroadcast
192.168.10.0/26192.168.10.1 - 192.168.10.62192.168.10.63
192.168.10.64/26192.168.10.65 - 192.168.10.126192.168.10.127
192.168.10.128/26192.168.10.129 - 192.168.10.190192.168.10.191
192.168.10.192/26192.168.10.193 - 192.168.10.254192.168.10.255

A network address has to start on one of those boundaries. 192.168.10.64/26 is a network. 192.168.10.70/26 is an address inside that network, and the calculator will normalize it back to .64. Drag the new prefix to cut a different parent.

New prefix

62 usable hosts

11111111111111111111111111000000
/26
/8/16/24/32
Network bitsHost bits

Each borrowed bit doubles the number of equal subnets and halves each one.

Borrowing 2 bits from 192.168.10.0/24 produces 4 equal /26 blocks. Each holds 64 addresses.

Equal subnets from 192.168.10.0/24 at /26
SubnetUsable rangeBroadcastUsable hosts
192.168.10.0/26192.168.10.1 - 192.168.10.62192.168.10.6362
192.168.10.64/26192.168.10.65 - 192.168.10.126192.168.10.12762
192.168.10.128/26192.168.10.129 - 192.168.10.190192.168.10.19162
192.168.10.192/26192.168.10.193 - 192.168.10.254192.168.10.25562

Open this split in the subnet splitter

Size one subnet from a host count

When you know how many interfaces a LAN needs, ignore the equal-split question and find the smallest prefix whose usable count is at least that number. Increase the host bits until 2 to that power, minus 2, covers the requirement. The prefix is 32 minus those host bits.

50 hosts do not fit in a /27, which has 30 usable hosts. They fit in a /26, which has 62. Watch the boundary. 30 hosts fit a /27 exactly. 31 hosts do not, and the next size is a /26. Leaving zero spare addresses is a choice. In a lab it is often the expected answer. On a live LAN, growth belongs in the requirement before you pick the prefix.

50 hosts need a /26. The mask is 255.255.255.192. The block holds 64 addresses and 62 usable hosts.

A /27 is the next size down, and it has only 30 usable hosts. That is short of 50.

04

VLSM (Variable Length Subnet Masking)

VLSM assigns a different prefix to each requirement, largest first, so a 100-host LAN does not consume the same block as a 10-host LAN. Each next block starts on its own size boundary, and the blocks must stay inside the parent network.

The order of work is fixed, even when the host counts are not:

  1. List every LAN and link with the number of hosts it needs.
  2. Turn each count into the smallest prefix that can hold it.
  3. Sort those prefixes from largest block to smallest.
  4. Place the first block at the parent network address.
  5. The next block starts at the previous broadcast, plus 1.
  6. Check that nothing overlaps and that everything is still inside the parent.

A /24 asked to hold 100, 50, 20, and 10 hosts comes out as 192.168.0.0/25 for 100, 192.168.0.128/26 for 50, 192.168.0.192/27 for 20, 192.168.0.224/28 for 10. 16 addresses in 192.168.0.0/24 are still free. Put the 10-host block at 192.168.0.0 first and the 100-host /25 can no longer start there. It has to jump to .128, and the addresses from .16 through .127 are stranded even though they were never assigned.

Change the parent or the host list. The planner sorts largest first and refuses a plan that does not fit. Open the VLSM calculator to use the same planner on its own page.

Subnet mask

255.255.255.0

Total addresses

256

Addresses left

16

192.168.0.0/24 has 16 addresses left after these blocks.

RequestedSubnetUsable rangeUsable hosts
100192.168.0.0/25192.168.0.1 - 192.168.0.126126
50192.168.0.128/26192.168.0.129 - 192.168.0.19062
20192.168.0.192/27192.168.0.193 - 192.168.0.22230
10192.168.0.224/28192.168.0.225 - 192.168.0.23814

Two hosts receive a /30, the textbook block with two usable addresses. A point-to-point link can instead use a /31 under RFC 3021. One host receives a /32.

Point-to-point links

A router-to-router link needs two addresses, one on each end. A /30 is the safe default: block size 4, two usable hosts, with the network and broadcast held back. It is the size most exam answers and older gear expect.

A /31 spends half as much. RFC 3021 says a point-to-point link has no broadcast, so both addresses are hosts. The mask is 255.255.255.254. Configure it only when both devices accept a /31. If one of them rejects the mask, use the /30.

Do not apply that exception to a LAN. A VLAN still has a broadcast, and a /31 there gives you two addresses and nowhere to put a gateway plus the hosts. The IP range calculator shows the inclusive range and the usable range as two different pairs, which is the distinction a /30 makes obvious.

Mistakes that produce a wrong plan

Calling the block size the host count. A /27 holds 32 addresses and 30 hosts. Write the minus 2 down until it is a habit, then remember the two prefixes where it does not apply.

Missing the minus 1 on the broadcast. The broadcast is network plus block size, minus 1. For a /26 starting at .64, 64 plus 64 is .128, and .128 is the next network. The broadcast is .127.

A network number that is not on a boundary. 192.168.1.100/26 is not a subnet identifier. A /26 must end in .0, .64, .128, or .192. Round the interesting octet down to a multiple of the block size before you treat the address as the network.

Overlap from skipping the sort. Two subnets that share even one address are a broken plan, even if each looked right on its own. Check membership of a disputed address in the IP in CIDR checker.

Questions

Count the host bits, which is 32 minus the prefix. Total addresses are 2 to that power. For /0 through /30, subtract 2: one address for the network and one for the broadcast. A /26 has 6 host bits, 64 addresses, and 62 usable hosts.

The all-zero host address names the subnet. The all-ones host address is the broadcast. Neither is assigned to a normal interface. The subtraction is a reservation, not a property of the power of two. It does not apply to a /31 or a /32.

A large block has a stricter starting alignment. A /25 must start on a multiple of 128. If you spend the .0 boundary on a tiny subnet, the /25 can no longer use it, and the addresses in between are stranded. Largest first leaves the next free address on a legal boundary for every smaller block.

An equal split borrows the same number of bits for every child, so a /24 cut to /26 is four identical blocks. VLSM gives each requirement its own prefix. A 100-host LAN and a 10-host LAN should not consume the same size.

Four. Each borrowed bit doubles the number of equal subnets. Borrowing 1 bit makes 2, borrowing 2 makes 4, and borrowing 3 makes 8. The new prefix is the old prefix plus the bits you borrowed.

A /26. It has 64 addresses and 62 usable hosts. A /27 has only 30 usable hosts, which is short of 50. The host sizer on this page does that comparison for any count.

No. A /27 steps by 32 in the last octet, so the legal networks end in .0, .32, .64, .96, and so on. 42 sits in the block that starts at 32. The network is 192.168.10.32/27.

Yes on current gear. The old subnet-zero restriction belonged to classful routing. It is not the same rule as holding back the network and broadcast addresses inside a subnet. Those two addresses are still not hosts, except on a /31.

A /30 is the widely supported choice: 4 addresses, 2 usable hosts. A /31, under RFC 3021, uses both of its addresses and spends nothing on a broadcast. Use a /31 when both ends of the link accept it. Use a /30 when you are not sure.

The block size is the total number of addresses, which is also how far apart consecutive networks of that prefix sit. For a prefix that changes the last octet, it is 256 minus that mask octet. A /26 mask ends in 192, and 256 minus 192 is 64.

Prefix rules follow RFC 4632. Point-to-point /31 links follow RFC 3021. Private address space is RFC 1918.