What Is IP Subnetting?
IP subnetting is the practice of dividing a large network into smaller sub-networks (subnets). Each subnet is a logical subdivision of an IP network, allowing for better organization, security isolation, and efficient use of IP addresses.
Understanding subnetting is essential for network engineers, system administrators, DevOps professionals, and anyone working with cloud infrastructure (AWS VPCs, Azure VNets, GCP VPCs all use subnetting concepts).
IPv4 Address Structure
An IPv4 address is a 32-bit number, typically written as four octets (bytes) in decimal, separated by dots:
192.168.1.100
│ │ │ └── Host portion
│ │ └──── Host portion
│ └──────── Network or host portion
└──────────── Network portion
Each octet ranges from 0 to 255 (8 bits). The boundary between the network and host portions is determined by the subnet mask.
Subnet Masks
A subnet mask is a 32-bit number with consecutive 1s followed by consecutive 0s:
255.255.255.0 = 11111111.11111111.11111111.00000000
The 1-bits indicate the network portion; the 0-bits indicate the host portion.
CIDR Notation is a compact way to express subnet masks as a prefix length:
192.168.1.0/24 means 24 bits for network, 8 bits for hosts
192.168.0.0/16 means 16 bits for network, 16 bits for hosts
10.0.0.0/8 means 8 bits for network, 24 bits for hosts
Common Subnet Sizes
| CIDR | Subnet Mask | Usable Hosts | Use Case |
|---|---|---|---|
| /30 | 255.255.255.252 | 2 | Point-to-point links |
| /29 | 255.255.255.248 | 6 | Small office segment |
| /28 | 255.255.255.240 | 14 | Small team subnet |
| /27 | 255.255.255.224 | 30 | Department subnet |
| /26 | 255.255.255.192 | 62 | Medium segment |
| /25 | 255.255.255.128 | 126 | Half of a /24 |
| /24 | 255.255.255.0 | 254 | Standard LAN |
| /23 | 255.255.254.0 | 510 | Two /24s combined |
| /22 | 255.255.252.0 | 1022 | Four /24s |
| /16 | 255.255.0.0 | 65,534 | Large enterprise |
| /8 | 255.0.0.0 | 16,777,214 | ISP allocation |
Formula: Usable hosts = 2^(32-prefix) - 2 (subtract network and broadcast addresses).
Network, Broadcast, and Host Addresses
For any subnet, three special addresses exist:
Network address: All host bits are 0. Identifies the subnet itself. Broadcast address: All host bits are 1. Sends to all hosts in subnet. Usable host range: Everything between network and broadcast.
Example for 192.168.1.0/24:
Network: 192.168.1.0 (host bits = 00000000)
First host: 192.168.1.1
Last host: 192.168.1.254
Broadcast: 192.168.1.255 (host bits = 11111111)
Private IP Address Ranges
RFC 1918 defines three ranges for private (non-routable) use:
| Range | CIDR | Addresses |
|---|---|---|
| 10.0.0.0 - 10.255.255.255 | 10.0.0.0/8 | 16,777,216 |
| 172.16.0.0 - 172.31.255.255 | 172.16.0.0/12 | 1,048,576 |
| 192.168.0.0 - 192.168.255.255 | 192.168.0.0/16 | 65,536 |
These addresses are used in home networks, corporate intranets, and cloud VPCs. They cannot be directly routed on the public internet.
Subnetting a Network
To divide 192.168.1.0/24 into 4 equal subnets:
- Need 2 bits for 4 subnets (2^2 = 4)
- New prefix: /24 + 2 = /26
- Each subnet has 2^6 - 2 = 62 usable hosts
Subnet 1: 192.168.1.0/26 (hosts: .1 - .62, broadcast: .63)
Subnet 2: 192.168.1.64/26 (hosts: .65 - .126, broadcast: .127)
Subnet 3: 192.168.1.128/26 (hosts: .129 - .190, broadcast: .191)
Subnet 4: 192.168.1.192/26 (hosts: .193 - .254, broadcast: .255)
Cloud Networking (AWS/Azure/GCP)
In cloud environments, subnets define network segmentation within a VPC (Virtual Private Cloud):
- Public subnets: Have internet gateway access (for load balancers, NAT)
- Private subnets: No direct internet access (for application servers, databases)
- VPC CIDR: Typically 10.0.0.0/16 (65,534 addresses)
- Subnet CIDR: Typically /24 per availability zone (254 addresses)
Using This Tool
Enter an IP address and CIDR notation (or subnet mask) to instantly see the network address, broadcast address, usable host range, number of hosts, subnet mask in all formats, and whether the IP is private or public.
-> Try the IPv4 Subnet Calculator