
Subnet Calculator Guide: Understanding CIDR Notation and Subnetting
Subnetting is one of the most important skills in networking, yet it is also one of the most intimidating for newcomers. Whether you are studying for a networking certification, planning a corporate network, or simply trying to understand why your home devices are on a "192.168.1.x" network, this guide will teach you subnetting from first principles.
We will start with the basics of binary addressing, build up to CIDR notation, walk through manual subnet calculations step by step, and provide reference tables that make real-world subnetting fast. You can also use our Subnet Calculator tool to perform these calculations instantly.
Why Subnetting Exists
In the early internet, IP addresses were allocated using a classful system:
| Class | Range | Default Mask | Networks | Hosts per Network |
|---|---|---|---|---|
| A | 1.0.0.0 - 126.255.255.255 | /8 (255.0.0.0) | 126 | 16,777,214 |
| B | 128.0.0.0 - 191.255.255.255 | /16 (255.255.0.0) | 16,384 | 65,534 |
| C | 192.0.0.0 - 223.255.255.255 | /24 (255.255.255.0) | 2,097,152 | 254 |
This system was enormously wasteful. An organization that needed 300 IP addresses would receive a Class B allocation (65,534 addresses), wasting over 65,000 addresses. Subnetting solves this by allowing network administrators to divide IP address blocks into smaller, right-sized segments.
Understanding Binary and IP Addresses
To truly understand subnetting, you need to be comfortable with binary representation. An IPv4 address is a 32-bit number, typically written as four decimal octets:
192.168.1.100 in decimal
11000000.10101000.00000001.01100100 in binaryEach octet is 8 bits, so the range for each octet is 0 (00000000) to 255 (11111111). Here is a quick binary-to-decimal reference for powers of 2:
| Bit Position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
To convert binary to decimal, add the values of all positions that have a 1. For example:
10101000 = 128 + 0 + 32 + 0 + 8 + 0 + 0 + 0 = 168Subnet Masks Explained
A subnet mask is a 32-bit number that divides an IP address into two parts: the network portion and the host portion. The mask consists of a contiguous block of 1s (network bits) followed by a contiguous block of 0s (host bits).
Example
IP Address: 192.168.1.100 = 11000000.10101000.00000001.01100100
Subnet Mask: 255.255.255.0 = 11111111.11111111.11111111.00000000
|----- network -----|-host-|When you perform a bitwise AND between the IP address and the subnet mask, you get the network address:
11000000.10101000.00000001.01100100 (IP: 192.168.1.100)
AND
11111111.11111111.11111111.00000000 (Mask: 255.255.255.0)
=
11000000.10101000.00000001.00000000 (Network: 192.168.1.0)All devices with IP addresses in the range 192.168.1.1 through 192.168.1.254 are on the same network (192.168.1.0/24). Address 192.168.1.0 is the network address (used to identify the subnet) and 192.168.1.255 is the broadcast address (used to send messages to all devices on the subnet).
CIDR Notation
CIDR (Classless Inter-Domain Routing) notation provides a compact way to express an IP address and its subnet mask. Instead of writing the full subnet mask, you append a slash followed by the number of network bits:
192.168.1.0/24 means 192.168.1.0 with mask 255.255.255.0
10.0.0.0/8 means 10.0.0.0 with mask 255.0.0.0
172.16.0.0/12 means 172.16.0.0 with mask 255.240.0.0The number after the slash is called the prefix length and indicates how many bits of the address are used for the network portion. Our Subnet Calculator accepts both CIDR notation and traditional subnet masks.
Complete CIDR Reference Table
Here is the complete reference table for all common prefix lengths:
| CIDR | Subnet Mask | Addresses | Usable Hosts | Typical Use |
|---|---|---|---|---|
| /32 | 255.255.255.255 | 1 | 1 | Single host route |
| /31 | 255.255.255.254 | 2 | 2 | Point-to-point links (RFC 3021) |
| /30 | 255.255.255.252 | 4 | 2 | Point-to-point links (traditional) |
| /29 | 255.255.255.248 | 8 | 6 | Small office |
| /28 | 255.255.255.240 | 16 | 14 | Small department |
| /27 | 255.255.255.224 | 32 | 30 | Medium department |
| /26 | 255.255.255.192 | 64 | 62 | Large department |
| /25 | 255.255.255.128 | 128 | 126 | Half a Class C |
| /24 | 255.255.255.0 | 256 | 254 | Standard network |
| /23 | 255.255.254.0 | 512 | 510 | Two Class C networks |
| /22 | 255.255.252.0 | 1,024 | 1,022 | Four Class C networks |
| /21 | 255.255.248.0 | 2,048 | 2,046 | Small campus |
| /20 | 255.255.240.0 | 4,096 | 4,094 | Medium campus |
| /16 | 255.255.0.0 | 65,536 | 65,534 | Large organization |
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 | Massive network |
Note: "Usable Hosts" is total addresses minus 2 (the network address and broadcast address), except for /31 which is a special case used for point-to-point links.
Step-by-Step Subnetting Examples
Example 1: Basic Subnet Calculation
Given: 192.168.10.0/26
Step 1: Determine the subnet mask.
/26 means 26 network bits and 6 host bits.
Mask: 11111111.11111111.11111111.11000000 = 255.255.255.192
Step 2: Calculate the number of addresses.
Host bits = 32 - 26 = 6
Total addresses = 2^6 = 64
Usable hosts = 64 - 2 = 62
Step 3: Identify the network range.
Network address: 192.168.10.0
First usable: 192.168.10.1
Last usable: 192.168.10.62
Broadcast: 192.168.10.63
Step 4: Identify the next subnet.
The next subnet starts at 192.168.10.64/26 (the address after the broadcast address of the first subnet).
Example 2: Finding Which Subnet a Host Belongs To
Given: Host IP 10.45.67.200 with mask /20
Step 1: Convert to binary and apply the mask.
10.45.67.200 = 00001010.00101101.01000011.11001000
/20 mask = 11111111.11111111.11110000.00000000
AND result = 00001010.00101101.01000000.00000000
= 10.45.64.0Step 2: The network address is 10.45.64.0/20.
Step 3: Calculate the range.
Host bits = 12, Total addresses = 4,096
Network: 10.45.64.0
Broadcast: 10.45.79.255
Usable range: 10.45.64.1 - 10.45.79.254
So host 10.45.67.200 is within the 10.45.64.0/20 subnet.
Example 3: Dividing a Network Into Equal Subnets
Task: Divide 172.16.0.0/16 into 8 equal subnets.
Step 1: Calculate additional bits needed.
8 subnets requires 3 additional bits (2^3 = 8).
New prefix: /16 + 3 = /19
Step 2: List the subnets.
| Subnet | Network Address | Usable Range | Broadcast |
|---|---|---|---|
| 1 | 172.16.0.0/19 | 172.16.0.1 - 172.16.31.254 | 172.16.31.255 |
| 2 | 172.16.32.0/19 | 172.16.32.1 - 172.16.63.254 | 172.16.63.255 |
| 3 | 172.16.64.0/19 | 172.16.64.1 - 172.16.95.254 | 172.16.95.255 |
| 4 | 172.16.96.0/19 | 172.16.96.1 - 172.16.127.254 | 172.16.127.255 |
| 5 | 172.16.128.0/19 | 172.16.128.1 - 172.16.159.254 | 172.16.159.255 |
| 6 | 172.16.160.0/19 | 172.16.160.1 - 172.16.191.254 | 172.16.191.255 |
| 7 | 172.16.192.0/19 | 172.16.192.1 - 172.16.223.254 | 172.16.223.255 |
| 8 | 172.16.224.0/19 | 172.16.224.1 - 172.16.255.254 | 172.16.255.255 |
Each subnet has 8,190 usable host addresses (2^13 - 2).
You can verify all of these calculations using our Subnet Calculator, which shows the network address, broadcast address, usable range, and total hosts for any CIDR block.
Variable-Length Subnet Masking (VLSM)
VLSM allows you to use different subnet sizes within the same network, allocating addresses more efficiently. Instead of creating eight equal /19 subnets, you can create subnets of different sizes based on actual need.
Example scenario: You have 10.0.0.0/24 and need to create subnets for:
- Department A: 100 hosts
- Department B: 50 hosts
- Department C: 25 hosts
- Server room: 10 hosts
- Two point-to-point links: 2 hosts each
Solution (allocate largest first):
| Department | Required | Subnet | Usable | Network |
|---|---|---|---|---|
| Dept A | 100 | /25 (128 addresses) | 126 | 10.0.0.0/25 |
| Dept B | 50 | /26 (64 addresses) | 62 | 10.0.0.128/26 |
| Dept C | 25 | /27 (32 addresses) | 30 | 10.0.0.192/27 |
| Servers | 10 | /28 (16 addresses) | 14 | 10.0.0.224/28 |
| Link 1 | 2 | /30 (4 addresses) | 2 | 10.0.0.240/30 |
| Link 2 | 2 | /30 (4 addresses) | 2 | 10.0.0.244/30 |
This allocates addresses efficiently with minimal waste. Without VLSM, you would need separate /24 networks for each department.
Private Address Ranges
Three IPv4 address ranges are reserved for private networks (RFC 1918). These addresses are not routable on the public internet and can be freely used within any organization:
| Range | CIDR | Addresses | Typical Use |
|---|---|---|---|
| 10.0.0.0 - 10.255.255.255 | 10.0.0.0/8 | 16,777,216 | Large enterprises |
| 172.16.0.0 - 172.31.255.255 | 172.16.0.0/12 | 1,048,576 | Medium organizations |
| 192.168.0.0 - 192.168.255.255 | 192.168.0.0/16 | 65,536 | Home and small office |
Your home network almost certainly uses 192.168.0.0/24 or 192.168.1.0/24. You can verify by comparing your device's local IP with the public IP shown on our My IP page. If they differ, you are behind NAT on a private subnet.
IPv6 Subnetting
IPv6 subnetting follows the same principles but with much larger numbers. The standard practice is:
- ISPs assign a /48 to each customer (or /56 for residential)
- Each /48 contains 65,536 /64 subnets
- Each /64 subnet supports 2^64 (18.4 quintillion) host addresses
IPv6 subnetting is generally simpler because address space is abundant, eliminating the need for careful conservation through VLSM. Explore IPv6 addressing with our IPv6 Tools.
Key Takeaways
- Subnetting divides a network into smaller segments by extending the network portion of the IP address
- CIDR notation (e.g., /24) indicates the number of network bits in the subnet mask
- The number of usable hosts is 2^(32 - prefix length) - 2
- VLSM allows mixing subnet sizes for efficient address allocation
- Always allocate the largest subnets first when using VLSM
- Private address ranges (10.x, 172.16-31.x, 192.168.x) are for internal use only
- Use our Subnet Calculator for instant calculations on any CIDR block
Related Articles:
WhatIsMyLocation Team
Our team of network engineers and web developers builds and maintains 25+ free networking and location tools used by thousands of users every month. Every article is reviewed for technical accuracy using real-world testing with our own tools.
Related Articles
Try Our Location Tools
Find your IP address, GPS coordinates, and more with our free tools.