← Blog

Subnetting Explained: How to Calculate Subnet Masks and IP Ranges

📅 May 2025 ⏱ 6 min read 🆓 Free tools · No signup

Subnetting is one of the fundamental skills in networking, yet it trips up students and professionals alike. The good news is that the logic behind it is consistent and learnable. This guide explains IP subnetting from the ground up — what it is, why it matters, and exactly how to calculate subnet sizes and IP ranges.

What Is Subnetting and Why Does It Matter?

An IP address (version 4) is a 32-bit number written in four decimal octets, like 192.168.1.100. The internet and private networks would be unmanageable if every device was on one giant flat network — traffic would be overwhelming and security would be impossible. Subnetting divides large networks into smaller, more manageable segments called subnets.

Subnets improve performance by limiting broadcast domains (devices that hear each other's broadcast traffic), improve security by isolating sensitive systems from general traffic, and allow efficient use of limited IP address space.

Understanding CIDR Notation

CIDR (Classless Inter-Domain Routing) notation expresses a subnet as an IP address followed by a slash and a prefix length: 192.168.1.0/24. The number after the slash (the prefix length) tells you how many bits of the address are the network portion, with the remaining bits identifying individual hosts.

A /24 prefix means 24 bits are the network address and 8 bits identify hosts. Since 8 bits can represent 256 values (0–255), a /24 subnet contains 256 addresses. However, 2 of those are reserved: the network address (all host bits = 0) and the broadcast address (all host bits = 1). So a /24 has 254 usable host addresses.

Common CIDR Subnets Quick Reference

Calculating Subnet Ranges Step by Step

Given a subnet 10.0.1.0/26, find the network address, broadcast address, first host, last host, and number of usable hosts:

Step 1: Determine the block size. /26 means 32 − 26 = 6 host bits. Block size = 2^6 = 64.

Step 2: Network address is 10.0.1.0 (given, with last octet starting at 0).

Step 3: Broadcast address = network address + block size − 1 = 10.0.1.0 + 64 − 1 = 10.0.1.63.

Step 4: First usable host = 10.0.1.1 (network address + 1).

Step 5: Last usable host = 10.0.1.62 (broadcast address − 1).

Step 6: Usable hosts = 64 − 2 = 62.

The Subnet Mask

Subnet masks are an older way of expressing the same information as CIDR prefix lengths. A /24 subnet has a subnet mask of 255.255.255.0 — the 24 "on" bits correspond to the three octets of 255, and the 8 "off" bits correspond to the final 0.

Private IP Address Ranges

Certain IP ranges are reserved for private network use and are not routable on the public internet:

Home routers typically use 192.168.0.x or 192.168.1.x. Enterprise networks often use 10.x.x.x for maximum flexibility. The 172.16.0.0/12 range is commonly used by cloud providers for VPC (Virtual Private Cloud) networks.

🌐 Calculate any subnet instantly with our free Subnet Calculator — CIDR, host ranges, and masks.

Try the Subnet Calculator →

Key Takeaways