Network Design: How to Choose the Right Subnet Mask for Your Needs
Most network design decisions look like technical details, yet the subnet mask you choose directly shapes the network's performance, security and how manageable it stays years later. "Just use /24 everywhere" works in small networks, but in growing environments it leads to wasted address space and avoidable security problems. This guide shows, step by step, how to choose the right CIDR prefix (/22, /24, /27 and so on) based on your device count and growth plan.
Key Criteria: Host Count and Broadcast Domain
Two criteria decide the right mask:
1. Host count: the total number of devices the subnet must hold. Usable hosts are calculated with this formula:
Usable hosts = 2^(32 − prefix) − 2
The two subtracted addresses are the network address (network ID) and the broadcast address. As an exception, /31 blocks defined in RFC 3021 make both addresses usable on point-to-point links.
2. Broadcast domain size: every subnet is a broadcast domain. The larger it gets, the more broadcast traffic such as ARP and DHCP every device has to process.
The selection method, step by step:
- List the devices: computers, IP phones, printers, cameras, access points, managed switches.
- Add at least 1 address for the gateway; add 2 if you use a redundant gateway (VRRP/HSRP).
- Account for growth.
- Find the smallest 2^n that covers (total need + 2).
- Prefix = 32 − n.
Example: an office with 45 staff needs 45 devices + 1 gateway = 46 addresses today. If growth to 60 devices is expected within two years, the need rises to 61. Since 61 + 2 = 63 ≤ 64 = 2^6, a /26 (62 usable hosts) is mathematically enough, but it leaves only 1 spare address. In practice /25 (126 usable hosts) is the much safer choice.
Ideal Masks for Small Networks (/24 – /30)
| Prefix | Mask | Total IPs | Usable Hosts | Typical Use |
|---|---|---|---|---|
| /30 | 255.255.255.252 | 4 | 2 | Point-to-point WAN links |
| /29 | 255.255.255.248 | 8 | 6 | Small router segments |
| /28 | 255.255.255.240 | 16 | 14 | Printer network, small management VLAN |
| /27 | 255.255.255.224 | 32 | 30 | Small department, management VLAN |
| /26 | 255.255.255.192 | 64 | 62 | User group of 40–55 devices |
| /25 | 255.255.255.128 | 128 | 126 | Office floor with 60–110 devices |
| /24 | 255.255.255.0 | 256 | 254 | Standard user VLAN |
Two notes: /30 is the classic choice for links between two routers; on devices that support RFC 3021 you can build the same link with a /31 and only 2 addresses. /24 is still a solid default for user networks: neither too small nor needlessly large.
CIDR Choices for Medium and Large Networks (/16 – /23)
| Prefix | Mask | Usable Hosts | Typical Use |
|---|---|---|---|
| /23 | 255.255.254.0 | 510 | Server segment, large user group |
| /22 | 255.255.252.0 | 1,022 | Guest Wi-Fi, large campus segment |
| /21 | 255.255.248.0 | 2,046 | Use with care as a single broadcast domain |
| /20 | 255.255.240.0 | 4,094 | Rarely used as a single subnet |
| /16 | 255.255.0.0 | 65,534 | Aggregate block for an address plan, not a single VLAN |
Important: a /22 or larger block should not be designed as a single VLAN (one broadcast domain). Address space of this size is usually split into several /24 VLANs and joined through routing. A /16 is treated as an aggregate block that summarizes a site's address plan, not as a single subnet.
Efficiency: The Risks of Oversized Subnets
Picking a large mask "just to be safe" is tempting, but it has a cost:
- Broadcast load: in a single subnet with thousands of devices, every device processes the ARP and DHCP broadcasts. This creates a small but constant performance cost, especially at peak hours.
- Security blast radius: devices in the same subnet can reach each other directly at layer 2. When one device is compromised, lateral movement is easier; the smaller the segment, the more limited the damage.
- Harder troubleshooting: analysing ARP tables or hunting duplicate IPs in a 500-device subnet is much slower than in a 60-device one.
- Address waste: with private (RFC 1918) addressing it looks free, but unplanned growth makes it harder to add new VLANs later. With public IPs, waste is a direct cost.
Scenarios: Office, Data Center and Guest Networks
Office Network
A sample VLAN plan for an office with 50–60 users per floor:
| VLAN | Purpose | Prefix | Usable Hosts |
|---|---|---|---|
| 10 | Users | /25 | 126 |
| 20 | Printers | /28 | 14 |
| 30 | Device management | /27 | 30 |
| 40 | VoIP phones | /26 | 62 |
Giving each function its own subnet makes the network easier to read for both security and troubleshooting.
Data Center
For a segment of 300 servers: 300 + 1 gateway = 301; 301 + 2 = 303 ≤ 512 = 2^9, so a /23 (510 usable hosts) fits. Splitting it into smaller blocks (/28, /27) per rack or function makes access control easier. Internal links between routers use /30 or /31.
Guest Network
For a Wi-Fi network expecting 500 concurrent guests: 500 + 1 = 501; 501 + 2 = 503 ≤ 512, so a /23 is mathematically enough but tight. A /22 (1,022 usable hosts) gives comfortable room. A common alternative is to create a /24 per floor or area instead of one huge subnet and to combine it with client isolation.
Growth Planning: How Much Spare Address Space?
A common practice is to reserve 20–50% more than the current need. The ratio depends on the planning horizon:
- In stable infrastructure such as switch management, the device count rarely changes for years, so a 20% margin is enough.
- For user and server networks, make a 3–5 year growth projection; for fast-growing companies, plan for close to 50%.
- Rule of thumb: one prefix step larger is enough. Where you need a /27, take a /26; taking a /24 is needless waste.
Example: a network with 80 devices today and a 30% growth margin: 80 × 1.3 ≈ 104 devices. 104 + 2 = 106 ≤ 128 = 2^7, so you choose a /25 (126 usable hosts).
Common Mistakes
- The "/24 everywhere" habit: on point-to-point links it wastes 252 addresses; /30 or /31 is the right choice.
- Forgetting the gateway and broadcast: a /24 has 254 usable addresses, but one goes to the gateway, so the device capacity is 253.
- Using a /16 "just in case": broadcast traffic and security risk pile up and the address plan becomes unreadable.
- Ignoring the VLAN–subnet mapping: every VLAN needs its own subnet; growing a subnet without adding VLANs is a design mistake.
- Mixing security levels in one subnet: keeping guest devices and corporate servers in the same broadcast domain is a serious risk.
- Not documenting the address plan: record which block was reserved for what; otherwise conflicts start within a year.
Once you have chosen a mask, the next step is to verify the math. With UK Bilişim's free subnet calculator at subnet.ukbilisim.net you can see the network address, broadcast address, usable host range and bit layout of any prefix in seconds. All calculations run in your browser; the IP addresses you enter are never sent to a server.
Frequently Asked Questions (FAQ)
Which subnet mask should I use for 50 devices? →
50 devices + 1 gateway = 51; 51 + 2 = 53 ≤ 64, so a /26 (62 usable hosts) is enough. If you expect meaningful growth, choose a /25.
When should I use a /30 or /31 mask? →
On point-to-point links between two routers. A /30 provides 4 addresses (2 usable); on devices that support RFC 3021, a /31 makes both of its 2 addresses usable as hosts and saves address space.
Is there real harm in choosing a subnet larger than needed? →
Yes. More broadcast traffic, a larger security blast radius and harder troubleshooting are the main costs. Even with private IPs, the consistency of the address plan suffers.
Do I need a separate subnet for every VLAN? →
Yes. Each VLAN is a separate broadcast domain and needs its own subnet; traffic between VLANs is handled by routing.
What growth margin should I plan for? →
A common practice is 20–50%, based on a 3–5 year projection. As a rule, growing by one prefix step is enough; more is usually waste.