HomeTechnical ConceptsConcept Detail
July 25, 2026 7 min read

What is a Subnet Mask and How Does it Work? (CIDR & IP Subnetting Guide)

Demystifying subnets. Learn the networking principles behind IP addresses, subnet masks, default gateways, and CIDR notation in plain English.

Quick Answer: A subnet mask is a 32-bit binary filter that splits an IPv4 address into a Network Identifier (which tells routers where your network lives) and a Host Identifier (which identifies your specific computer or phone). In standard home networks, the subnet mask 255.255.255.0 (written in CIDR notation as /24) allows up to 254 distinct local devices to communicate without routing conflicts.

In computer networking, a subnetwork (subnet) is a logical, segmented partition of an IP network. Subnetting allows network engineers and router firmware to divide larger address spaces into smaller, manageable subnets to prevent broadcast storms, optimize routing efficiency, and enforce security boundaries across private local area networks (LANs).

Diagnostic: Common Subnet Configuration Symptoms & Fixes

Networking Symptom Underlying Subnet Cause Resolution Action
Device has IP 192.168.1.50 but cannot ping gateway 192.168.0.1 Subnet mismatch (/24 mask confines communication to 192.168.1.x) Change client static IP to 192.168.0.50 or enable DHCP auto-assign
Printer invisible to phones on Wi-Fi Guest Wi-Fi or IoT VLAN isolated on separate subnet (e.g. 192.168.20.0/24) Move printer to main LAN subnet or configure inter-VLAN routing rules
Double NAT warning on Xbox/PlayStation Modem and router both running active DHCP on overlapping subnets Set ISP modem to Bridge Mode or configure secondary router in AP Mode
DHCP pool exhausted, new devices cannot connect Subnet scope too small for client density (e.g. /28 with only 14 hosts) Expand subnet mask to /24 (254 hosts) or reduce DHCP lease duration

Master IPv4 Subnet Mask & CIDR Reference Table

The table below summarizes common CIDR prefix lengths, subnet masks, wildcard masks, and usable host device capacities. You can verify custom calculations using our interactive CIDR Subnet Calculator.

CIDR Prefix Subnet Mask (Dotted Decimal) Wildcard Mask Total Addresses Usable Host Capacity Standard Application
/24 255.255.255.0 0.0.0.255 256 254 hosts Standard Home & Small Office LAN
/25 255.255.255.128 0.0.0.127 128 126 hosts Departmental Subnet Division
/26 255.255.255.192 0.0.0.63 64 62 hosts Office VLAN Isolation
/27 255.255.255.224 0.0.0.31 32 30 hosts Server Cluster / Staging DMZ
/28 255.255.255.240 0.0.0.15 16 14 hosts Security Camera / IoT Subnet
/29 255.255.255.248 0.0.0.7 8 6 hosts ISP Static IP Block Allocation
/30 255.255.255.252 0.0.0.3 4 2 hosts Point-to-Point Router WAN Links

Step-by-Step Guide: How to Calculate Usable Subnet IP Ranges

  1. Step 1: Determine Total Address Bits
    An IPv4 address consists of 32 bits divided into four 8-bit octets. For a given prefix /N, the host bits remaining equal 32 - N.
  2. Step 2: Calculate Usable Host Capacity
    Apply the mathematical formula 2^(Host Bits) - 2. We subtract 2 because the very first address represents the Network ID and the last address represents the Broadcast ID. For example, with a /26 mask: 32 - 26 = 6 host bits, yielding 2^6 - 2 = 62 usable host addresses.
  3. Step 3: Calculate the Network Address
    Perform a bitwise AND operation between the device IP and the subnet mask. For IP 192.168.1.50 with mask 255.255.255.192, the base network address is 192.168.1.0.
  4. Step 4: Identify First and Last Usable Hosts
    The first usable host is Network Address + 1 (192.168.1.1). The last usable host is Broadcast Address - 1 (192.168.1.62).

Frequently Asked Questions

Why can't I assign the first or last IP in a subnet to my computer?

The first IP is strictly reserved as the Network Identifier for packet routing tables, and the final IP is reserved as the Broadcast Address to simultaneously transmit discovery packets to all active local nodes.

What happens if two devices on a network have different subnet masks?

If two client devices are configured with differing subnet masks, they will miscalculate the local broadcast domain boundary and fail to communicate directly without intermediate router forwarding.

What is CIDR notation and why did it replace Classful IP addressing?

CIDR (Classless Inter-Domain Routing) replaced rigid Class A, B, and C address boundaries by allowing variable-length subnet masks (VLSM), dramatically slowing the exhaustion of IPv4 addresses and shrinking global BGP routing tables.

The Bottom Line

Subnetting is the fundamental building block of IP networking. Understanding subnet masks and CIDR notation allows you to configure DHCP scopes, isolate guest and IoT networks with VLANs, and eliminate IP address routing collisions on your home or enterprise infrastructure.

Back to Technical ConceptsBack to Homepage