plain/devtools home

CIDR subnet sizes from /8 to /32

How many addresses does a /24 hold, and what does a /20 look like? The table below is computed by code, then a calculator lets you check any block.

Last reviewed 2026-10-21. Usable-host counts follow the classic rule (total minus network and broadcast), with /31 and /32 as special cases. The AWS column follows the reserved-address rule in the AWS documentation linked below.

cidr-calculatorsamplesCtrl↵ run · s sample

Is an IP inside this block?

Split into smaller subnets

never leaves your browser

The idea in one line

A CIDR block is an address plus a prefix length: 10.0.0.0/24 means the first 24 of 32 bits are fixed and the last 8 bits are free, so the block holds 2^8 = 256 addresses. Each step down in prefix length doubles the block. RFC 4632 defines the notation and the way blocks aggregate.

Usable hosts are usually the block size minus two, because the first address names the network and the last is the broadcast address. A /31 has no room for that, and RFC 3021 allows both addresses of a /31 on a point-to-point link. A /32 is a single host route.

IPv4 prefix table

Find your prefix, read across. The mask and wildcard columns are what firewalls and older router syntax ask for.

PrefixNetmaskWildcardAddressesUsable hostsUsable in an AWS subnet
/8255.0.0.00.255.255.25516,777,21616,777,214not allowed
/9255.128.0.00.127.255.2558,388,6088,388,606not allowed
/10255.192.0.00.63.255.2554,194,3044,194,302not allowed
/11255.224.0.00.31.255.2552,097,1522,097,150not allowed
/12255.240.0.00.15.255.2551,048,5761,048,574not allowed
/13255.248.0.00.7.255.255524,288524,286not allowed
/14255.252.0.00.3.255.255262,144262,142not allowed
/15255.254.0.00.1.255.255131,072131,070not allowed
/16255.255.0.00.0.255.25565,53665,53465,531
/17255.255.128.00.0.127.25532,76832,76632,763
/18255.255.192.00.0.63.25516,38416,38216,379
/19255.255.224.00.0.31.2558,1928,1908,187
/20255.255.240.00.0.15.2554,0964,0944,091
/21255.255.248.00.0.7.2552,0482,0462,043
/22255.255.252.00.0.3.2551,0241,0221,019
/23255.255.254.00.0.1.255512510507
/24255.255.255.00.0.0.255256254251
/25255.255.255.1280.0.0.127128126123
/26255.255.255.1920.0.0.63646259
/27255.255.255.2240.0.0.31323027
/28255.255.255.2400.0.0.15161411
/29255.255.255.2480.0.0.786not allowed
/30255.255.255.2520.0.0.342not allowed
/31255.255.255.2540.0.0.122 (point to point)not allowed
/32255.255.255.2550.0.0.011 (single host)not allowed

AWS reserves five addresses in every IPv4 subnet (the first four and the last), and allows subnet sizes from /28 to /16, so blocks larger than a /16 or smaller than a /28 are not valid subnets there.

Planning: how many subnets fit in a /16

A common plan is one /16 per network and /20 to /24 per subnet. Each extra bit of prefix halves the subnet size and doubles how many fit in the /16.

Subnet sizeSubnets in a /16Addresses each
/17232,768
/18416,384
/1988,192
/20164,096
/21322,048
/22641,024
/23128512
/24256256
/25512128
/26102464
/27204832
/28409616

Counts are 2 to the power of (prefix minus 16) and 2 to the power of (32 minus prefix).

Private ranges

RFC 1918 reserves three blocks for private networks. Pick VPC and office ranges that do not overlap, or you cannot peer or VPN them later without renumbering.

BlockRangeAddresses
10.0.0.0/810.0.0.0 to 10.255.255.25516,777,216
172.16.0.0/12172.16.0.0 to 172.31.255.2551,048,576
192.168.0.0/16192.168.0.0 to 192.168.255.25565,536

Source: RFC 1918, section 3.

Common mistakes

  • Planning to the usable-host number and forgetting the cloud reservations: a /28 in AWS has 16 addresses and 11 you can use.
  • Using a /24 for everything. It is easy to read, but a /24 spread across a few services wastes space, and a /16 of /24s is only 256 subnets.
  • Overlapping ranges between environments. Choose distinct blocks per environment and region from day one.
  • Treating the table as IPv6 guidance. IPv6 subnets are normally /64, and the host-count arithmetic here does not apply.

Frequently asked questions

How many hosts are in a /24?

A /24 holds 256 addresses and 254 usable hosts under the classic rule. In an AWS subnet, 251 are usable because AWS reserves five.

What is the difference between a netmask and a wildcard mask?

The wildcard is the bitwise inverse of the netmask. 255.255.255.0 and 0.0.0.255 describe the same /24. Access lists on some routers use the wildcard form.

Why is /31 usable on a link?

RFC 3021 allows a /31 on point-to-point links so both addresses can be assigned to the two ends, saving the network and broadcast addresses.

What size should my VPC be?

AWS lets a subnet be between /28 and /16. Choose a block that leaves room to add subnets, avoids overlap with other networks you may connect, and sits inside an RFC 1918 range.

Sources

Related

esc
↑↓ move↵ open? all shortcuts

Keyboard shortcuts

Cmd or Ctrl shortcuts always work.
Everywhere
Everywhere
Open the command palette
CtrlK
Open the palette (outside a text field)
/
Show these shortcuts
?
Toggle light and dark theme
t
Go home
gh
Go to all tools
gt
On a tool page
On a tool page
Run the main action
Ctrl↵
Copy the output
c
Load the next sample
s
Focus the input
i
Leave a text field
Esc
Previous or next tool
[]
In the palette
In the palette
Move the selection
↑↓
Open the selected item
↵
Close
Esc