Subnetting means taking one larger network and dividing it into smaller, self-contained networks called subnets. Say a company has a single block of address space, like 192.168.1.0/24. It can split that block up to give separate, isolated ranges to different departments, floors, or VLANs, instead of putting every device on one flat network.
Why subnet at all?
- Smaller broadcast domains. Every device on the same subnet shares broadcast traffic (ARP requests, DHCP discovery, and so on). Fewer devices per subnet means less broadcast noise and better performance.
- Isolation and security. Traffic between subnets has to pass through a router. This gives you a natural point to apply access control, like keeping a guest Wi-Fi subnet from reaching internal servers.
- Efficient use of address space. Instead of wasting a large block of addresses on a department with only 10 devices, subnetting lets you size each network to roughly match what it actually needs.
💡 In simple terms: subnetting is like dividing one big open-plan office into separate rooms. Everyone can still reach everyone else through the hallway (the router), but noise and traffic inside one room no longer spill into every other room.
The subnet mask and prefix length
A subnet mask marks which bits of an IPv4 address are the network portion and which are the host portion. A 1 marks a network bit, a 0 marks a host bit. 255.255.255.0 in binary is 24 ones followed by 8 zeros. That's why it's also written as the CIDR prefix /24: the number after the slash simply counts the leading 1 bits.
| Prefix | Subnet mask | Host bits | Usable hosts |
|---|---|---|---|
/24 | 255.255.255.0 | 8 | 254 |
/25 | 255.255.255.128 | 7 | 126 |
/26 | 255.255.255.192 | 6 | 62 |
/27 | 255.255.255.224 | 5 | 30 |
/28 | 255.255.255.240 | 4 | 14 |
/29 | 255.255.255.248 | 3 | 6 |
/30 | 255.255.255.252 | 2 | 2 |
That last column follows 2ⁿ − 2, where n is the number of host bits. You subtract 2 for the reserved network and broadcast addresses on every subnet. The CIDR Calculator converts between prefix and mask instantly. The Wildcard Mask Calculator shows the inverted form of a mask, used in access lists and OSPF configuration.
Splitting one network into equal subnets
The core move in subnetting is borrowing host bits to create more network bits. Take 192.168.1.0/24 and borrow 2 bits from the host portion to make it a /26. Those 2 borrowed bits give 2² = 4 equal-sized subnets, each with 2⁶ − 2 = 62 usable hosts:
| Subnet | Network address | Usable range | Broadcast |
|---|---|---|---|
| 1 | 192.168.1.0/26 | .1 – .62 | 192.168.1.63 |
| 2 | 192.168.1.64/26 | .65 – .126 | 192.168.1.127 |
| 3 | 192.168.1.128/26 | .129 – .190 | 192.168.1.191 |
| 4 | 192.168.1.192/26 | .193 – .254 | 192.168.1.255 |
Enter 192.168.1.0/26 into the Subnet Calculator. It will show you the full breakdown: network address, broadcast address, and usable host range, for any address and prefix you give it.
Try it: divide a network visually
Use the controls below to borrow more or fewer bits from 192.168.1.0/24 and watch it split into equal subnets in real time.
Borrow 2 host bits from 192.168.1.0/24 to create 4 subnets of /26 each.
192.168.1.0/26
192.168.1.64/26
192.168.1.128/26
192.168.1.192/26
192.168.1.0 – 63192.168.1.64 – 127192.168.1.128 – 191192.168.1.192 – 255Real-world scenario: subnetting an office by department
A small office needs three separate networks: HR, Finance, and IT. Each one is isolated from the others for security, and they all share one 192.168.1.0/24 block:
Devices within HR can talk to each other directly, without a router. If Finance needs to reach a file server on the IT subnet, that traffic has to pass through the router. That's exactly where a network administrator would apply a rule to allow or block it.
VLSM: subnets of different sizes
Splitting into equal subnets is simple, but it wastes space when departments need very different numbers of hosts. VLSM (Variable Length Subnet Masking) solves this by giving each subnet only as many host bits as it actually needs. The standard approach: sort requirements largest-first. Then allocate each one starting from the next free address, sized to the smallest power of two that fits.
For example, start from 192.168.1.0/24 with three requirements: Sales needs 50 hosts, Engineering needs 25, and Guest Wi-Fi needs 10:
| Department | Hosts needed | Allocated block | Usable hosts |
|---|---|---|---|
| Sales | 50 | 192.168.1.0/26 | 62 |
| Engineering | 25 | 192.168.1.64/27 | 30 |
| Guest Wi-Fi | 10 | 192.168.1.96/28 | 14 |
Each block is sized to its actual need, instead of every department getting an identical, mostly-empty /26. You don't need to do this by hand. The VLSM Calculator takes a base network and a list of named requirements, and produces exactly this kind of allocation table.
A quick mental-math shortcut
- Number of subnets =
2raised to the number of bits you borrow. - Block size is the gap between each subnet's network address. It equals
256minus the last non-255 octet of the subnet mask. For a/26mask (255.255.255.192), that's256 − 192 = 64. That's exactly the spacing in the four-subnet table above (.0, .64, .128, .192).