How to Calculate Subnets — CIDR, Mask & IP Ranges

Introduction

In the world of networking, subnetting is the foundational skill that enables efficient IP address allocation, network segmentation, and traffic control.

Why Learn Subnetting?

  • Certification preparation (CompTIA Network+, Cisco CCNA)
  • Network design and infrastructure planning
  • Troubleshooting connectivity and routing issues
  • Security implementation through network segmentation
  • Career advancement in IT and networking roles

Manual vs Calculator Methods

A subnet calculator provides instant results, but mastering the manual method gives you:

  • Deeper insight into network design principles
  • Troubleshooting capabilities when tools aren't available
  • Interview confidence for technical positions
  • Understanding of security and traffic flow
  • Professional credibility in networking roles

What You'll Master

This guide teaches you to calculate:

  • Network addresses and broadcast addresses
  • Usable host ranges for any subnet
  • Subnet masks in CIDR and dotted-decimal formats
  • Binary logic behind subnetting decisions
  • Network planning for VLANs and enterprise infrastructure

By the end, you'll look at /26 and instantly know it provides 62 usable hosts—a skill that separates competent technicians from true networking professionals.

The Binary Foundation of Subnetting

Every IPv4 address is a 32-bit binary number, typically written in dotted-decimal notation (e.g., 192.168.1.10). Subnetting divides this 32-bit space into two parts:

  • Network portion: Identifies the subnet
  • Host portion: Identifies devices within that subnet

The subnet mask (or CIDR prefix) defines where this split occurs.

CIDR Notation vs. Subnet Mask

  • CIDR (Classless Inter-Domain Routing): Written as /N, where N is the number of network bits (e.g., /24).
  • Subnet Mask: A 32-bit number with N leading 1s and (32−N) trailing 0s, written in dotted-decimal (e.g., 255.255.255.0 for /24).

Key Conversion:

  • /2411111111.11111111.11111111.00000000255.255.255.0
  • /2611111111.11111111.11111111.11000000255.255.255.192

Step-by-Step Subnet Calculation

Given an IP and CIDR (e.g., 192.168.10.50/26):

1. Determine the Subnet Mask

Convert /26 to dotted-decimal:

  • First 24 bits = 255.255.255
  • Next 2 bits = 11000000 = 192
  • Subnet Mask = 255.255.255.192

2. Find the Block Size (Increment)

The block size is the value of the least significant bit in the subnet mask’s last octet.

  • For /26, last octet = 11000000
  • Least significant 1 is in the 64s place (128, 64, 32, 16, 8, 4, 2, 1)
  • Block Size = 64

3. Identify the Network Address

Find the largest multiple of the block size ≤ the IP’s last octet.

  • IP last octet = 50
  • Multiples of 64: 0, 64, 128…
  • 0 ≤ 50 below 64 → Network = 192.168.10.0

4. Find the Broadcast Address

Broadcast = Network + Block Size − 1
192.168.10.0 + 64 − 1 = 192.168.10.63

5. Determine Usable Host Range

  • First Usable Host: Network + 1 → 192.168.10.1
  • Last Usable Host: Broadcast − 1 → 192.168.10.62
  • Total Usable Hosts: 2^(32−N) − 22⁶ − 2 = 62

Common CIDR Prefixes & Host Counts

| CIDR | Subnet Mask | Host Bits | Usable Hosts | |------|-------------------|-----------|--------------| | /30 | 255.255.255.252 | 2 | 2 | | /29 | 255.255.255.248 | 3 | 6 | | /28 | 255.255.255.240 | 4 | 14 | | /27 | 255.255.255.224 | 5 | 30 | | /26 | 255.255.255.192 | 6 | 62 | | /25 | 255.255.255.128 | 7 | 126 | | /24 | 255.255.255.0 | 8 | 254 |

Subnetting for Network Design

  • Point-to-Point Links: Use /30 (2 hosts) for router-to-router connections.
  • Small Offices: /26 (62 hosts) for departments.
  • Large Networks: /24 (254 hosts) for entire sites.
  • VLANs: Assign a subnet per VLAN for security and broadcast control.

IPv6 Subnetting (Brief Overview)

IPv6 uses 128-bit addresses and typically uses /64 subnets for all local networks (even if only 2 devices are present). The vast address space makes conservation unnecessary, simplifying design. Prefixes like 2001:db8::/32 are common for documentation.

💡Quick Tips

  • Bookmark this page for quick reference
  • Practice with real examples to master the concepts
  • Use keyboard shortcuts for faster calculations