Network & API7 min read

IP Subnet Calculator: CIDR Notation, Subnet Masks, and Network Ranges Explained

Learn how IP subnetting works, how to read CIDR notation, calculate usable host ranges, and why subnetting matters for VPC design, firewalls, and network architecture.

Try the free online tool mentioned in this guide:IP / Subnet Calculator

What is a subnet?

A subnet (subnetwork) is a logical division of an IP address space. Instead of one flat network where every device can reach every other device, subnetting divides the address space into smaller, isolated ranges. Each subnet has a network address, a broadcast address, and a range of usable host addresses.

Subnetting is fundamental to VPC design in cloud providers (AWS, GCP, Azure), firewall rules, private network architecture, and understanding routing.

CIDR notation explained

CIDR (Classless Inter-Domain Routing) notation combines an IP address with a prefix length: 192.168.1.0/24.

The prefix length (after the slash) indicates how many bits of the 32-bit IP address are the network portion. The remaining bits are the host portion.

  • /24 = 24 network bits, 8 host bits → 256 addresses (254 usable)
  • /16 = 16 network bits, 16 host bits → 65,536 addresses (65,534 usable)
  • /32 = 32 network bits, 0 host bits → single host (no subnetting)
  • /0 = 0 network bits → entire internet
text
192.168.1.0/24

IP:     192.168.1.0    = 11000000.10101000.00000001.00000000
Mask:   255.255.255.0  = 11111111.11111111.11111111.00000000
                                                    └─ host bits (8)

Network address:   192.168.1.0   (first address)
Broadcast address: 192.168.1.255 (last address)
Usable hosts:      192.168.1.1 – 192.168.1.254 (254 hosts)

Subnet mask reference table

text
CIDR  Subnet Mask       Hosts    Usable Hosts
/8    255.0.0.0         16777216   16777214
/16   255.255.0.0       65536      65534
/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 (point-to-point, RFC 3021)
/32   255.255.255.255   1          1 (single host)

Calculating subnets: practical examples

Example 1: You have 10.0.0.0/16 and need to split into 4 equal subnets.

Borrow 2 bits from the host portion: /16 → /18. Four subnets: - 10.0.0.0/18 (10.0.0.0 – 10.0.63.255) - 10.0.64.0/18 (10.0.64.0 – 10.0.127.255) - 10.0.128.0/18 (10.0.128.0 – 10.0.191.255) - 10.0.192.0/18 (10.0.192.0 – 10.0.255.255)

Example 2: AWS VPC default is 172.31.0.0/16. Default subnets are /20 each, giving 4,096 addresses (4,091 usable — AWS reserves 5 per subnet) per AZ.

Private IP ranges (RFC 1918)

Three IP ranges are reserved for private networks and are not routable on the public internet:

  • 10.0.0.0/8 — 16.7 million addresses. Used for large enterprise networks and cloud VPCs.
  • 172.16.0.0/12 — 1 million addresses (172.16.0.0 – 172.31.255.255). Docker uses 172.17.0.0/16 by default.
  • 192.168.0.0/16 — 65,536 addresses. Used by home routers, small office networks.
text
# Quick check: is an IP private?
10.0.0.0    – 10.255.255.255   → private (10.0.0.0/8)
172.16.0.0  – 172.31.255.255   → private (172.16.0.0/12)
192.168.0.0 – 192.168.255.255  → private (192.168.0.0/16)
127.0.0.0   – 127.255.255.255  → loopback
169.254.0.0 – 169.254.255.255  → link-local (APIPA)

Subnetting in cloud VPCs

When designing AWS VPC subnets:

  • Use /16 for the VPC (65,536 addresses — plenty to grow).
  • Use /24 per subnet per AZ (254 usable — typical for app tiers).
  • Separate public subnets (internet-facing load balancers) from private subnets (app servers) from isolated subnets (databases).
  • Plan for future expansion — IP address space is cheap; re-subnetting a production VPC is painful.
  • AWS reserves 5 IP addresses per subnet (first 4 and last 1), so a /28 gives only 11 usable hosts.

Frequently asked questions

What does /24 mean in an IP address?

/24 is CIDR notation meaning 24 bits are the network prefix. This leaves 8 bits for hosts: 2^8 = 256 addresses, of which 254 are usable (network and broadcast addresses are reserved).

What is the difference between a subnet mask and CIDR notation?

They represent the same thing in different formats. /24 and 255.255.255.0 are equivalent — both indicate that the first 24 bits identify the network and the last 8 bits are for hosts.

How many hosts fit in a /28 subnet?

2^(32-28) = 16 addresses, minus 2 (network and broadcast) = 14 usable hosts. In AWS, subtract 5 reserved addresses → 11 usable.

What is a supernet?

A supernet combines multiple smaller subnets into a larger block using a shorter prefix. /23 is a supernet of two /24 subnets. Used for route summarization to reduce routing table size.

Try IP / Subnet Calculator for free

Compute IPv4 and IPv6 CIDR details: netmask, wildcard, broadcast, first and last host, and subnet size. Runs locally in your browser. No install, no account required to try it.