Words like subnet, CIDR or subnet mask sound complicated, but they really describe one simple idea: how to divide a pool of IP addresses into smaller, clearer chunks. In this article we explain what a subnet is, what notation like /24 means and how the network address and broadcast are calculated. If you want to check anything on your own numbers right away, use our subnet calculator. If you are still unsure about the basics of addressing, we recommend reading What is an IP address first.

What is a subnet and why it matters

An IP address is a number that identifies a device on a network. When you have many devices at home or in a company, it is not practical to keep them all in one huge group. That is exactly why subnetting (dividing into subnets) was created.

A subnet is a reserved part of a larger network in which devices communicate with each other directly, without needing a router. Picture a large building split into floors. Each floor is its own unit, yet they all belong to the same building. Splitting into subnets brings three main benefits:

  • Order: devices are grouped logically (for example offices, cameras, servers).
  • Security: traffic between subnets can be controlled and restricted.
  • Performance: a smaller subnet means less unnecessary network noise (broadcast traffic).

What is a subnet mask

A subnet mask is the tool that decides which part of an IP address belongs to the network and which part belongs to a specific device (host). It looks like a regular IP address, for example 255.255.255.0.

The principle is simple: where the mask has ones (the number 255), that part belongs to the network. Where it has zeros, that is the space for individual devices. So with the mask 255.255.255.0 the first three parts of the address (for example 192.168.1) define the network, and the last part (for example .15) defines the specific device.

Computers store everything in binary (bits, that is zeros and ones). The number 255 in binary is eight ones in a row. So the mask really tells you how many of the first bits of the address are “locked” for the network. And this is exactly what the CIDR notation is built on.

What CIDR notation means (for example /24)

CIDR (Classless Inter-Domain Routing) is a shorter and more modern way to write a mask. Instead of writing out the whole mask 255.255.255.0, you simply add a slash and a number after the IP address, for example 192.168.1.0/24.

The number after the slash (the prefix) tells you how many of the first bits of the address belong to the network. An IPv4 address has 32 bits in total, so:

  • /24 means 24 bits for the network and the remaining 8 bits for devices. This equals the mask 255.255.255.0.
  • /16 means 16 bits for the network (mask 255.255.0.0), which is a much larger network.
  • /8 means 8 bits for the network (mask 255.0.0.0), which is a huge range.

There is a simple rule: the higher the number after the slash, the smaller the subnet and the fewer devices. The lower the number, the larger the subnet.

How the network address and broadcast are calculated

Every subnet has two special addresses that are never assigned to devices:

  • The network address is the very first address in the range. It labels the whole subnet as a unit. For 192.168.1.0/24 it is 192.168.1.0.
  • The broadcast is the very last address in the range. It is used to reach all devices in the subnet at once. For 192.168.1.0/24 it is 192.168.1.255.

So with /24 we have 256 addresses in total (from .0 to .255). The network address is .0, the broadcast is .255, and devices are left with the range from 192.168.1.1 to 192.168.1.254.

Doing this by hand with less common prefixes (for example /26 or /30) tends to be slow. That is why it pays off to enter the IP and prefix into the subnet calculator, which computes the network address, broadcast and range instantly.

Why there are 2 fewer usable hosts

A common question is: why can I not fit 256 devices into a /24 subnet when it has 256 addresses? The answer comes down to those two special addresses.

The network address and the broadcast are reserved and cannot be assigned to a regular device. That is why two addresses are always subtracted from the total. The number of usable hosts is calculated with this formula:

  • Total number of addresses for prefix n: 2 to the power of (32 minus n).
  • Usable hosts: that number minus 2.

Examples:

  • /24: 256 addresses, 254 usable devices.
  • /26: 64 addresses, 62 usable devices.
  • /30: 4 addresses, 2 usable devices (typical for a link between two routers).

Private IP ranges

Not all addresses travel across the public internet. So called private ranges are reserved for internal networks and can be used by anyone at home or in a company without registration:

  • 10.0.0.0 to 10.255.255.255 (written 10.0.0.0/8) · a very large range, often used in companies.
  • 172.16.0.0 to 172.31.255.255 (written 172.16.0.0/12) · a medium range.
  • 192.168.0.0 to 192.168.255.255 (written 192.168.0.0/16) · the best known one, typical for home routers.

These addresses are not routed on the public internet. On the way out, the router translates them into a single public IP address using a technology called NAT (network address translation).

A practical example of splitting a network

Imagine a company with the address space 192.168.10.0/24, that is 254 usable addresses. We want to separate three groups: offices, cameras and guests. Instead of one large network, we split it into smaller subnets using the /26 prefix (each has 62 usable addresses):

  • Offices: 192.168.10.0/26, range 192.168.10.1 to 192.168.10.62.
  • Cameras: 192.168.10.64/26, range 192.168.10.65 to 192.168.10.126.
  • Guests: 192.168.10.128/26, range 192.168.10.129 to 192.168.10.190.

This split improves both order and security, because you can easily control who has access to what between the groups. If you want to check the boundaries of any subnet without manual math, enter the IP and prefix into our subnet calculator and you will get the network address, broadcast, mask, range and host count in a single step.

And if you need your network segmented for real, at home or at work, we will design it for you.

This article is part of our Computer networks overview.