Calculate subnet mask, network address, broadcast address, and usable host range from any IP address and CIDR notation.
Common subnet sizes
| Subnet mask | 255.255.255.0 |
| Wildcard mask | 0.0.0.255 |
| CIDR notation | 192.168.1.0/24 |
| IP class | Class C |
| IP type | Private |
| CIDR | Hosts | Mask |
|---|---|---|
| /24 | 254 | 255.255.255.0 |
| /25 | 126 | 255.255.255.128 |
| /26 | 62 | 255.255.255.192 |
| /27 | 30 | 255.255.255.224 |
| /28 | 14 | 255.255.255.240 |
| /29 | 6 | 255.255.255.248 |
| /30 | 2 | 255.255.255.252 |
Network and broadcast addresses are reserved and cannot be assigned to hosts. For /31 and /32 subnets, all addresses are usable per RFC 3021.
A subnet calculator helps you divide IP networks into smaller, more manageable segments called subnets. It takes an IP address and CIDR prefix (like /24) and calculates essential network information including the network address, broadcast address, subnet mask, and the range of usable host IP addresses.
Whether you're setting up a home network, configuring cloud infrastructure, or studying for a networking certification, understanding subnetting is fundamental to IP networking.
Subnetting is based on binary math applied to 32-bit IPv4 addresses. The CIDR prefix indicates how many bits represent the network portion, with remaining bits available for host addresses.
An IPv4 address consists of 32 bits, typically written as four octets in decimal form:
192.168.1.100 = 11000000.10101000.00000001.01100100
The subnet mask determines which bits identify the network and which identify the host. A /24 network uses 24 bits for the network portion:
Subnet mask /24 = 11111111.11111111.11111111.00000000
= 255.255.255.0
Network address: Apply a bitwise AND between the IP and subnet mask:
Broadcast address: The network address with all host bits set to 1.
Usable hosts: Total addresses minus network and broadcast:
For IP address 192.168.1.100/24:
Classless Inter-Domain Routing (CIDR) replaced the older classful network addressing in 1993. The IETF introduced CIDR to slow IPv4 address exhaustion and reduce routing table sizes.
CIDR notation combines an IP address with a prefix length:
192.168.1.0/24
The number after the slash indicates how many bits form the network prefix. More bits for the network means fewer for hosts.
| CIDR | Subnet mask | Total addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2 |
| /32 | 255.255.255.255 | 1 | 1 |
The original IP addressing scheme divided networks into classes:
This rigid system wasted addresses. An organization needing 300 hosts would receive a Class B with 65,536 addresses—wasting 65,000+ IPs. CIDR allows variable-length subnet masks, enabling precise allocation.
Two types of masks appear in networking, serving opposite purposes.
The subnet mask identifies the network portion through 1 bits:
/24 = 255.255.255.0 = 11111111.11111111.11111111.00000000
Network devices use subnet masks to determine whether destination IPs are local or remote.
The wildcard mask is the inverse—0 bits represent matching and 1 bits represent "don't care":
Wildcard for /24 = 0.0.0.255 = 00000000.00000000.00000000.11111111
Wildcard masks appear in Access Control Lists (ACLs) and routing protocols like OSPF. To convert:
Understanding IP classification helps with network design and troubleshooting.
These addresses are reserved for internal networks and cannot be routed on the public internet:
| Range | CIDR | Purpose |
|---|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | Large networks |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | Medium networks |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | Home/small office |
| Range | Purpose |
|---|---|
| 127.0.0.0/8 | Loopback (localhost) |
| 169.254.0.0/16 | Link-local (APIPA) |
| 224.0.0.0/4 | Multicast |
| 240.0.0.0/4 | Reserved/experimental |
Network Address Translation (NAT) allows multiple devices with private IPs to share a single public IP. Your router performs NAT, translating between your internal 192.168.x.x addresses and your ISP-assigned public IP.
Most home routers use 192.168.1.0/24 or 192.168.0.0/24, providing 254 usable addresses—plenty for typical households. Some routers use 10.0.0.0/24 for variety.
A /23 network (512 addresses) or multiple /24 subnets separated by department provides room for growth while maintaining organizational boundaries.
Cloud providers like AWS, Azure, and GCP reserve additional addresses per subnet:
| Provider | Reserved per subnet |
|---|---|
| AWS | 5 addresses |
| Azure | 5 addresses |
| GCP | 4 addresses |
For a /24 in AWS, usable hosts = 256 - 5 = 251 (not 254).
/30 subnets provide exactly 2 usable addresses—perfect for router-to-router connections. /31 subnets (RFC 3021) are also valid for point-to-point links, providing 2 addresses with no waste.
VLSM allows creating subnets of different sizes from a single network, optimizing address utilization.
Starting with 192.168.1.0/24, create subnets for:
Solution:
Always allocate largest subnets first to avoid fragmentation.
Supernetting combines multiple smaller networks into a larger block for routing efficiency.
Four /24 networks can combine into one /22:
Becomes: 192.168.0.0/22
This reduces routing table entries from 4 to 1, improving router performance.
Allocate specific IPs for:
Reserve 20-30% more addresses than current requirements. Reconfiguring subnets later is disruptive.
Maintain an IP address management (IPAM) spreadsheet or tool documenting:
Establish patterns like:
Cannot reach local devices: Check that devices are on the same subnet. Different subnets require routing.
Duplicate IP addresses: Ensure DHCP pools don't overlap with static assignments.
Subnet mask mismatch: All devices on a subnet must use the same mask. A device with /23 on a /24 network will have connectivity issues.
Wrong default gateway: The gateway must be on the same subnet as the host.
# Windows
ipconfig /all
route print
# Linux/Mac
ip addr show
ip route show
While this calculator focuses on IPv4, IPv6 uses similar concepts with 128-bit addresses:
IPv6 addresses are written in hexadecimal: 2001:0db8:85a3:0000:0000:8a2e:0370:7334
The network address (all host bits 0) identifies the network itself. The broadcast address (all host bits 1) reaches all hosts on the subnet. Neither can be assigned to individual hosts.
A /30 subnet provides 2 usable addresses, ideal for point-to-point links. /31 and /32 subnets are special cases for point-to-point and single hosts.
Expanding the mask (e.g., /24 to /23) generally works if the adjacent block is available. Shrinking requires ensuring no devices fall outside the new range.
Apply the subnet mask to both the IP in question and the network address. If the results match, the IP belongs to that subnet.
They're identical—just different notations. /24 is CIDR notation (24 network bits). 255.255.255.0 is dotted decimal notation for the same mask.
From a /16 network, you could create 256 /24 subnets, 512 /25 subnets, or any combination totaling the original address space.