DevOps

What Is a Subnet Mask? A Practical Guide to Subnetting.

Written by noc724 team3 min readUpdated Oct 18, 2026

Every IPv4 address has two parts: which network it belongs to and which device it is on that network. The subnet mask is what draws the line between them. Once you can read a mask, firewall rules, routing tables and cloud network settings stop looking like magic.

Key takeaways

  • A subnet mask marks which bits of an address identify the network and which identify the host.
  • CIDR notation writes the mask as a prefix length: 255.255.255.0 is /24.
  • A /24 has 256 addresses and 254 usable hosts; each extra prefix bit halves the size.
  • The first address is the network address and the last is the broadcast address.
  • Two devices talk directly only if they are in the same subnet; otherwise traffic goes through a router.
Downtime happens. Get notified!

noc724 checks your websites, servers and APIs around the clock and alerts you by SMS, Telegram or Bale the moment something breaks.

Register for FREE

Addresses are just 32 bits

An IPv4 address like 192.168.10.37 is four 8-bit numbers (octets):

192      .168      .10       .37
11000000 .10101000 .00001010 .00100101

A subnet mask is another 32-bit number made of ones followed by zeros. The ones cover the network part, the zeros the host part:

255      .255      .255      .0
11111111 .11111111 .11111111 .00000000

CIDR notation

Counting the ones gives the prefix length. 255.255.255.0 has 24 ones, so 192.168.10.37/24 means "this address, with a 24-bit network part". CIDR (Classless Inter-Domain Routing) notation is what you will see in cloud consoles, firewalls and routing tables.

Network, broadcast and usable hosts

For 192.168.10.37/24:

ItemValue
Network address (all host bits 0)192.168.10.0
Broadcast address (all host bits 1)192.168.10.255
Usable hosts192.168.10.1 - 192.168.10.254 (254 addresses)

The formula for usable hosts is 2^(32 - prefix) - 2. The two subtracted addresses are the network and broadcast addresses.

Common masks

CIDRMaskAddressesUsable hosts
/32255.255.255.25511 (a single host)
/30255.255.255.25242 (point-to-point links)
/29255.255.255.24886
/28255.255.255.2401614
/27255.255.255.2243230
/26255.255.255.1926462
/24255.255.255.0256254
/22255.255.252.01,0241,022
/16255.255.0.065,53665,534
/8255.0.0.016,777,21616,777,214

A worked example: splitting a /24

You have 10.20.30.0/24 and need four equal subnets. Borrow two host bits (2^2 = 4), giving /26 subnets of 64 addresses each:

SubnetNetworkUsable rangeBroadcast
110.20.30.0/26.1 - .62.63
210.20.30.64/26.65 - .126.127
310.20.30.128/26.129 - .190.191
410.20.30.192/26.193 - .254.255

The subnet calculator does this arithmetic for any address and prefix.

How devices use the mask

When a computer sends a packet, it applies its mask to its own address and to the destination:

  • Same network? It delivers the packet directly on the local network.
  • Different network? It sends the packet to its default gateway (a router).

A wrong mask therefore causes strange half-working networks: a host might reach some neighbours directly and route others through the gateway, or not reach them at all.

Private address ranges

These ranges are reserved for internal networks and are not routed on the internet:

  • 10.0.0.0/8
  • 172.16.0.0/12
  • 192.168.0.0/16

Monitoring services that check from the internet can't reach these addresses. To monitor internal systems, run checks from inside the network - for example with a private location.

Frequently asked questions

  • The first 24 bits of the address identify the network. A /24 network has 256 addresses, of which 254 can be assigned to devices.

  • The all-zeros host address names the network itself and the all-ones address is the broadcast address used to reach every host on it.

  • IPv6 uses the same prefix idea but only in CIDR form, such as /64. The dotted mask format is IPv4 only.

Share this article:XTelegramLinkedInFacebookReddit
noc724

Written by

The noc724 team

Uptime monitoring engineers

We build and run noc724, an uptime monitoring service that checks websites, servers and APIs from several cities in Iran. These guides come from the problems we and our users run into while keeping services online.

Contact the team

Expert on:DevOps

Questions?Contact Support
Feature suggestions?Share

Recent Articles