Copied!

What Is a Subnet?

A subnet is a slice of a network, defined by its mask. Subnet masks, CIDR notation and how to work out the network, broadcast and host range, with an example.

What Is Subnetting?

Subnetting splits one big network into smaller ones called subnets. Each subnet is its own segment, which keeps traffic tidy, lets you set different rules per segment and makes addresses easier to manage. An office building split into departments: each has its own floor, but it is still one building.

Why bother: broadcasts stay inside their own subnet, so there is less noise. You can apply different security rules to different subnets. And you stop wasting addresses.

Understanding Subnet Masks

A subnet mask says which part of an IP address names the network and which part names the host. It is 32 bits, same as an IPv4 address. 255.255.255.0 in binary is 11111111.11111111.11111111.00000000: the 1s are the network portion, the 0s the host portion. Apply it to 192.168.1.100 and you get:

  • Network address: 192.168.1.0 (the first 24 bits)
  • Host portion: .100 (the last 8 bits)
Subnet MaskCIDRBinaryUsable Hosts
255.0.0.0/811111111.00000000.00000000.0000000016,777,214
255.255.0.0/1611111111.11111111.00000000.0000000065,534
255.255.255.0/2411111111.11111111.11111111.00000000254
255.255.255.128/2511111111.11111111.11111111.10000000126
255.255.255.192/2611111111.11111111.11111111.1100000062
255.255.255.240/2811111111.11111111.11111111.1111000014

CIDR Notation

CIDR (Classless Inter-Domain Routing) notation writes address and mask together: a slash and the number of network bits instead of the full mask. 192.168.1.0/24 means network 192.168.1.0 with mask 255.255.255.0. The number after the slash is the prefix length, how many of the 32 bits belong to the network; the rest is for hosts.

Calculating Network, Broadcast, and Host Range

Take 192.168.1.100/24:

  1. Subnet mask: /24 = 255.255.255.0
  2. Network address: a bitwise AND of the IP and the mask gives 192.168.1.0
  3. Broadcast address: all host bits set to 1 gives 192.168.1.255
  4. First usable host: network address + 1 = 192.168.1.1
  5. Last usable host: broadcast address - 1 = 192.168.1.254
  6. Total usable hosts: 28 - 2 = 254

The general formula is 2(32 - prefix) - 2. The 2 you subtract are the network and broadcast addresses, which no device can use.

Practical Subnetting Example

You have 10.0.0.0/24 (254 hosts) and want four equal subnets:

SubnetNetwork AddressHost RangeBroadcastUsable Hosts
110.0.0.0/2610.0.0.1 - 10.0.0.6210.0.0.6362
210.0.0.64/2610.0.0.65 - 10.0.0.12610.0.0.12762
310.0.0.128/2610.0.0.129 - 10.0.0.19010.0.0.19162
410.0.0.192/2610.0.0.193 - 10.0.0.25410.0.0.25562

Going from /24 to /26 borrows 2 bits from the host portion: 22 = 4 subnets, each with 26 - 2 = 62 usable addresses. Our Subnet Calculator does this for any CIDR block, no binary math needed.

Subnet Calculator
Try it on a real address. Free, no account needed.