Developer Tools

CIDR Subnetting Explained: How to Actually Calculate a Subnet Range

CIDR notation like /24 tells you how many addresses a subnet has β€” but working out the actual range by hand trips up a lot of people. The math, a worked example, and the reference table you'll actually reuse.

October 29, 2026 3 min read Toolio Editorial
CIDR Subnetting Explained: How to Actually Calculate a Subnet Range
Summarize with:

CIDR notation β€” the "/24" you see appended to an IP address β€” packs two pieces of information into a few characters: which part of the address identifies the network, and which part identifies individual hosts on it. Reading it correctly is one thing; calculating the actual address range it covers by hand is where most people get stuck.

What the Prefix Number Actually Means

An IPv4 address is 32 bits long. The number after the slash β€” the prefix length β€” tells you how many of those 32 bits are fixed as the "network" portion. The remaining bits are available for host addresses.

Host bits = 32 βˆ’ Prefix length

Usable addresses = 2^(Host bits) βˆ’ 2

The "βˆ’2" accounts for the network address (all host bits zero) and the broadcast address (all host bits one), neither of which can be assigned to a device β€” this applies to traditional subnetting; some contexts (like point-to-point /31 links, defined in RFC 3021) are a deliberate exception.

A Worked Example

Take 192.168.1.0/24:

  • Host bits = 32 βˆ’ 24 = 8
  • Total addresses = 2⁸ = 256
  • Usable addresses = 256 βˆ’ 2 = 254
  • Range: 192.168.1.0 (network address, unusable) to 192.168.1.255 (broadcast address, unusable) β€” so hosts can use 192.168.1.1 through 192.168.1.254

Now take a smaller subnet, 192.168.1.0/28:

  • Host bits = 32 βˆ’ 28 = 4
  • Total addresses = 2⁴ = 16
  • Usable addresses = 16 βˆ’ 2 = 14
  • Range: 192.168.1.0 to 192.168.1.15, with 192.168.1.1–192.168.1.14 usable

Quick Reference Table

Prefix Subnet mask Total addresses Usable addresses
/24 255.255.255.0 256 254
/25 255.255.255.128 128 126
/26 255.255.255.192 64 62
/27 255.255.255.224 32 30
/28 255.255.255.240 16 14
/29 255.255.255.248 8 6
/30 255.255.255.252 4 2

Why the Prefix Has to Match Across a Network

Every device on the same subnet needs to agree on the same prefix length β€” a device configured with the wrong subnet mask will miscalculate which addresses are "local" versus which need to go through a router, causing exactly the kind of intermittent connectivity issues that are miserable to debug. When troubleshooting, checking that every device's subnet mask matches is one of the first things worth ruling out.

Common Mistakes

  • Forgetting to subtract network and broadcast addresses. A /24 has 256 total addresses but only 254 usable ones.
  • Confusing the prefix length with the number of hosts directly. /24 doesn't mean "24 hosts" β€” it means 24 network bits, leaving 8 host bits.
  • Mismatched subnet masks between devices on the same network, which causes routing confusion that looks like a random connectivity problem.

Frequently Asked Questions

What's the difference between /24 and a "Class C" network? Historically, "Class C" specifically meant /24 under the older classful addressing system. CIDR replaced that rigid system, allowing any prefix length, not just the fixed class boundaries.

Can I have a /31 or /32 subnet? Yes β€” /32 identifies a single host (often used for loopback addresses), and /31 is specifically permitted for point-to-point links under RFC 3021, since a link between exactly two devices doesn't need separate network/broadcast addresses.

Does this work the same way for IPv6? The prefix-length concept is the same, but IPv6's address space is vastly larger (128 bits instead of 32), so the specific host-count math and typical prefix lengths used in practice differ substantially.

Use the CIDR Subnet Calculator to check your own ranges instantly. See also our guide on public vs private IP addressing and NAT for the broader addressing picture this fits into.

Source: RFC 4632 (Classless Inter-Domain Routing), the IETF standard defining CIDR.

Free Calculator

Put this guide into action

Stop guessing β€” use our AI Token & API Cost Calculator to run real numbers, compare scenarios, and get instant results you can trust.

Use Free AI Token & API Cost Calculator
Toolio Editorial

Toolio Editorial Senior Technical Editors & UX Content Engineers

Digital Utilities, Web Engineering & Tool Guides

The Toolio Editorial Board is dedicated to delivering clear, transparent, and accurate technical guides across digital utilities, developer tools, unit conversion standards, date-time algorithms, and decision science. The board maintains rigorous editorial standards, factual accuracy, and step-by-step clarity for every guide published.

Try Calculator AI Token & API Cost Calculator
Use Tool

Continue Reading

AI ADVISOR & COACH

Ask AI Advisor

Ask AI