Guide

What is a Subnet Mask? CIDR and Subnetting Explained

A subnet mask divides an IP address into a network portion and a host portion, defining which devices are on the same local network. Learn how subnet masks work, what CIDR notation means, and how to calculate network ranges.

The problem a subnet mask solves

An IPv4 address is 32 bits — just a number. By itself it does not tell you which part identifies the network and which part identifies the specific device on that network. A subnet mask answers that question.

When your computer wants to send data to another IP address, it first checks: is this address on my local network, or does it need to go to the router? The subnet mask is what it uses to make that decision.

How a subnet mask works

A subnet mask is also a 32-bit number. Every 1 bit in the mask corresponds to a network bit in the IP address; every 0 bit is a host bit.

Example: 192.168.1.45 with mask 255.255.255.0
IP: 192.168.1.45
Mask: 255.255.255.0
← blue = network portion · green = host portion
Network: 192.168.1.0
Host range: 192.168.1.1 – 192.168.1.254
Broadcast: 192.168.1.255

CIDR notation — the shorthand

Writing 255.255.255.0 every time is verbose. CIDR (Classless Inter-Domain Routing) notation expresses the same thing as a suffix — the number of leading 1 bits in the mask.

192.168.1.0/24 = 192.168.1.0 with mask 255.255.255.0
10.0.0.0/8 = 10.0.0.0 with mask 255.0.0.0
172.16.0.0/16 = 172.16.0.0 with mask 255.255.0.0

The prefix length tells you how many hosts fit in the subnet: 2^(32 - prefix) - 2 usable hosts (subtract 2 for the network address and broadcast address).

Common subnet sizes

CIDRSubnet maskUsable hostsTypical use
/8255.0.0.016,777,214Very large networks (Class A)
/16255.255.0.065,534Large office / ISP blocks (Class B)
/24255.255.255.0254Typical home / small office LAN
/25255.255.255.128126Split a /24 into two halves
/28255.255.255.24014Small server segments
/30255.255.255.2522Point-to-point links
/32255.255.255.2551Single host / loopback route

Private IP ranges

Three address ranges are reserved for private networks (RFC 1918) — they are never routed on the public internet:

  • 10.0.0.0/8 — 10.x.x.x, ~16 million addresses
  • 172.16.0.0/12 — 172.16.x.x to 172.31.x.x, ~1 million addresses
  • 192.168.0.0/16 — 192.168.x.x, ~65,000 addresses (home networks)

Related guides

Calculate subnet ranges, broadcast addresses, and host counts

Enter any IP and CIDR prefix to get the full breakdown

Open Subnet Calculator →
What is a Subnet Mask? CIDR and Subnetting Explained | DataToolkit | DataToolkit