Skip to content
gohacks.dev
DevOps

IPv4 Subnet Calculator

Work out the network, broadcast, netmask, wildcard mask, usable host range and size of any IPv4 CIDR block, and split it into smaller subnets.

Free · No sign-up · Your inputs stay in your browser

Input

Calculate an IPv4 subnet

Output

10.20.28.0/22

Network10.20.28.0
Broadcast10.20.31.255
Netmask255.255.252.0
Wildcard (ACLs)0.0.3.255
First host10.20.28.1
Last host10.20.31.254
Addresses1,024
Usable hosts1,022
TypePrivate (RFC 1918)
Mask in binary11111111.11111111.11111100.00000000

4 subnets of /24

10.20.28.0/24 10.20.29.0/24 10.20.30.0/24 10.20.31.0/24

A /31 has no network or broadcast address (RFC 3021, point-to-point links) and a /32 is one host. Cloud providers reserve more: AWS keeps the first four and the last address of every VPC subnet, so a /24 there has 251 usable addresses.

Runs in this browser. Nothing you paste is sent to a server.

Reading a prefix

A /22 keeps the first 22 bits as the network and leaves 10 for hosts: 1,024 addresses, of which 1,022 are usable because the first is the network address and the last the broadcast. Each step down in prefix doubles the size. RFC 4632 defines the CIDR notation.

Planning a VPC

Cloud networks are where this comes up most. Choose a block from the RFC 1918 private ranges large enough to grow into, such as a /16, and give each subnet a /20 or /24. Avoid ranges that overlap with an office VPN or a peered network, because overlapping blocks cannot be routed to each other. AWS reserves five addresses in every subnet, so a /24 there has 251 usable.

Share

Frequently asked questions

How many hosts are in a /24?
256 addresses and 254 usable hosts, since the network and broadcast addresses cannot be assigned.
What is a wildcard mask?
The netmask inverted: 0.0.3.255 for a /22. Cisco ACLs and some firewall rules use it instead of a netmask.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools