Networking

Subnet Calculation – CIDR, Netmask & Host Range Explained

NordVPN
Recommended
Ad
  • 5,000+ Servers
  • No Logging
  • Up to 10 Devices
Protect your IP with NordVPN →

What Is a Subnet?

A subnet (subnetwork) is a logically segmented portion of a larger IP network. Subnetting divides a large network into smaller, more manageable segments – improving security, reducing broadcast traffic, and simplifying administration.

Every subnet is defined by two values:

  • Network address – the first address of the subnet
  • Subnet mask – determines how many addresses the subnet contains

Understanding CIDR Notation

CIDR notation (Classless Inter-Domain Routing) writes an IP address with a slash followed by the prefix length:

192.168.1.0/24

The number after the slash indicates how many of the 32 bits of the IP address belong to the network part. The remaining bits are available for hosts.

CIDR Netmask Usable Hosts Typical Use
/8 255.0.0.0 16,777,214 Large organizations
/16 255.255.0.0 65,534 Medium enterprises
/24 255.255.255.0 254 Home network, small offices
/25 255.255.255.128 126 Department network
/26 255.255.255.192 62 Small department
/28 255.255.255.240 14 Small segment
/30 255.255.255.252 2 Point-to-point link

Calculating a Subnet Step by Step

Example: 192.168.1.0/24

Step 1: Determine the netmask

With /24, the first 24 bits are set:

11111111.11111111.11111111.00000000 = 255.255.255.0

Step 2: Calculate the network address

IP address AND netmask (bitwise AND):

192.168.1.100  = 11000000.10101000.00000001.01100100
255.255.255.0  = 11111111.11111111.11111111.00000000
               = 11000000.10101000.00000001.00000000
               = 192.168.1.0  ← Network address

Step 3: Calculate the broadcast address

Set all host bits to 1:

192.168.1.255  ← Broadcast address

Step 4: Usable host range

First usable address:  192.168.1.1
Last usable address:   192.168.1.254
Number of usable hosts: 2^8 - 2 = 254

Wildcard Mask

The wildcard mask is the inverse of the subnet mask – primarily used in ACLs (Access Control Lists) on Cisco devices:

Netmask:        255.255.255.0
Wildcard mask:  0.0.0.255

Calculation: invert all bits, or compute 255.255.255.255 - netmask.

Private IP Ranges

The following ranges are reserved for home and internal networks (RFC 1918):

Range CIDR Addresses
10.0.0.0 10.0.0.0/8 ~16 million
172.16.0.0 172.16.0.0/12 ~1 million
192.168.0.0 192.168.0.0/16 ~65,000

These addresses are not routable on the internet and can be freely used in private networks.

Supernetting – Aggregating Multiple Networks

The opposite of subnetting: supernetting (also called CIDR aggregation) combines several smaller networks into a larger one. This reduces the size of routing tables.

Example: The networks 192.168.0.0/24 and 192.168.1.0/24 can be summarized as 192.168.0.0/23.

Calculate Subnets Online

Use our free Subnet Calculator to instantly:

  • Calculate network address, broadcast and netmask
  • Determine the usable host range
  • View the binary representation of IP and mask
  • Test different CIDR prefixes with quick-select buttons

Last updated: March 2024

Surfshark
Best Value
Ad
  • Unlimited Devices
  • CleanWeb
  • From €1.99/month
Try Surfshark VPN →