Understanding Subnetting and Network Division

Subnetting is the process of dividing an IP address space into smaller, logical network segments. The 32-bit IPv4 address consists of two parts: a network portion and a host portion. Routers examine the network bits to forward traffic between subnets, while the host bits identify individual devices within that subnet.

Without subnetting, a single organization would need either one massive network (inefficient) or multiple entirely separate networks (wasteful of address space). Subnetting lets you create multiple logical networks from a single block of addresses, improving security, reducing broadcast domain size, and enabling better resource management.

The boundary between network and host portions is defined by the subnet mask—a 32-bit value where consecutive 1 bits mark the network portion and 0 bits mark the host portion. For example, the mask 255.255.255.0 uses 24 bits for the network and 8 bits for hosts, expressed as a /24 in CIDR notation.

Subnet Masks and CIDR Notation

In the early days of IPv4, only three predefined classes existed: Class A (255.0.0.0), Class B (255.255.0.0), and Class C (255.255.255.0). This rigid system created an all-or-nothing problem—a company needing 300 addresses had to lease an entire Class B subnet with 65,534 usable hosts, wasting thousands of addresses.

Classless Inter-Domain Routing (CIDR) eliminated this restriction. With CIDR, any number of bits can define the network portion, enabling fine-grained allocation. A /25 subnet offers 128 total addresses (126 usable), while a /22 provides 1,024 total addresses (1,022 usable)—much more flexible than the three-class model.

The CIDR notation /24 means "the first 24 bits are the network." Converting between formats:

  • Subnet mask 255.255.255.128 equals /25
  • Subnet mask 255.255.252.0 equals /22
  • Subnet mask 255.255.255.0 equals /24

Calculating Network Properties from IP and Subnet Mask

Once you have an IP address and subnet mask, five key properties can be derived:

Network Address = IP AND Subnet Mask

Broadcast Address = Network Address OR (NOT Subnet Mask)

First Usable Host = Network Address + 1

Last Usable Host = Broadcast Address − 1

Total Addresses = 2(32 − CIDR)

Usable Hosts = Total Addresses − 2

  • IP — The IPv4 address being analyzed, expressed in dotted decimal notation (e.g., 192.168.1.50)
  • Subnet Mask — The 32-bit mask defining the network boundary, expressed as dotted decimal (e.g., 255.255.255.0) or CIDR (e.g., /24)
  • Network Address — The first IP in the subnet; identifies the entire network segment
  • Broadcast Address — The last IP in the subnet; used for sending packets to all hosts in the subnet
  • CIDR — Classless Inter-Domain Routing notation: the count of network bits (e.g., /24 means 24 network bits, 8 host bits)

Public vs. Private IP Addresses

IPv4 addresses fall into two categories. Public addresses are globally unique and routable across the Internet; ISPs assign them to edge devices. Private addresses are reserved for internal networks and never routed on the public Internet.

The three private address ranges defined by RFC 1918 are:

  • 10.0.0.0/8 — 10.0.0.0 to 10.255.255.255 (16.7 million addresses)
  • 172.16.0.0/12 — 172.16.0.0 to 172.31.255.255 (1 million addresses)
  • 192.168.0.0/16 — 192.168.0.0 to 192.168.255.255 (65,536 addresses)

Any IP outside these ranges (and excluding special ranges like 127.0.0.0/8 and 169.254.0.0/16) is public. Most home networks use 192.168.x.x; corporate networks often use 10.x.x.x for scalability.

Common Subnetting Pitfalls and Best Practices

Avoid these frequent mistakes when working with subnets and network planning.

  1. Forgetting the Network and Broadcast Addresses — The first and last addresses in every subnet are reserved: the network address identifies the subnet itself, and the broadcast address sends traffic to all hosts at once. Neither can be assigned to individual devices, reducing usable host count by two in every subnet. A /30 subnet has only 4 total addresses but just 2 usable hosts.
  2. Confusing Subnet Mask Notation — Decimal notation (255.255.255.0) and CIDR notation (/24) describe the same thing, but it's easy to misread. Always double-check: /24 means the first 24 bits are the network, leaving 8 bits for hosts. Write both forms when planning to avoid miscommunication with colleagues.
  3. Miscalculating Supernets and Route Summarization — When combining multiple subnets into a single route prefix, the CIDR value decreases. Summarizing 192.168.0.0/24 and 192.168.1.0/24 yields 192.168.0.0/23, not /25. This matters for router configuration and BGP announcements—an error can cause traffic blackholes.
  4. Ignoring Address Space Exhaustion in Growth Planning — Allocating a /28 subnet (14 usable hosts) to a department seems reasonable until the business expands. Redesigning subnets mid-deployment is painful and error-prone. Always reserve extra CIDR blocks for future growth, or use NAT to extend limited space temporarily.

Frequently Asked Questions

What is the relationship between CIDR notation and the number of usable hosts?

CIDR notation directly determines host capacity. Subtract the CIDR value from 32 to find the host bits; then raise 2 to that power to get total addresses. For a /24 subnet: 32 − 24 = 8 host bits, so 2⁸ = 256 total addresses, minus 2 reserved (network and broadcast) = 254 usable hosts. A /25 has 2⁷ = 128 total addresses, yielding 126 usable hosts. Smaller CIDR numbers (like /16) provide more addresses; larger numbers (like /30) provide fewer.

How do I identify if an IP address is private or public?

Check the IP against RFC 1918 private ranges: 10.0.0.0 to 10.255.255.255, 172.16.0.0 to 172.31.255.255, and 192.168.0.0 to 192.168.255.255. Also check for loopback (127.0.0.1), link-local (169.254.x.x), multicast (224.x.x.x onwards), and broadcast (255.255.255.255). Any address outside these reserved blocks is public. For instance, 8.8.8.8 is public, while 192.168.50.100 is private.

What is a wildcard mask and how does it differ from a subnet mask?

A wildcard mask is the bitwise inverse of a subnet mask. Where a subnet mask has 1 bits in the network portion and 0 bits in the host portion, a wildcard mask reverses this: 0 in the network, 1 in the host. Wildcard masks are used in network access lists and routing advertisements (like OSPF areas). For example, subnet mask 255.255.255.0 inverts to wildcard mask 0.0.0.255. Both represent the same network boundary but emphasize different bits.

How do I manually calculate the broadcast address of a subnet?

Start with the network address (found by ANDing the IP with the subnet mask). Add the total number of addresses in the subnet, then subtract one. For a /24 subnet with network 192.168.1.0, there are 256 total addresses, so the broadcast is 192.168.1.0 + 256 − 1 = 192.168.1.255. Alternatively, invert all host bits (those not covered by the subnet mask) to 1.

Why does a /31 subnet have 2 usable hosts when the rule says minus 2?

RFC 3021 created an exception for /31 subnets (2 addresses total) used for point-to-point links. Traditionally, both addresses are reserved (network and broadcast), leaving zero usable hosts. But on dedicated point-to-point connections (like router-to-router links), both addresses can be assigned to devices since there's no need for a broadcast address. Standard subnets (/30 and larger) still follow the minus-2 rule.

Can I use subnet calculators for IPv6 addressing?

Most IPv6 calculators handle the fundamentals, but IPv6 differs significantly from IPv4. IPv6 uses 128-bit addresses and /64 is the standard subnet size (providing 2⁶⁴ addresses). Subnetting is far simpler because address space is enormous—organizations rarely exhaust it. Additionally, IPv6 does not use broadcast addresses or subnet masks in the same way; instead, it uses multicast. Dedicated IPv6 calculators account for these differences.

More other calculators (see all)