CIDR Subnet Calculator

CIDR subnet calculator with membership checks

Runs in your browserUtility07Network & Web

What is CIDR Subnet Calculator?

A CIDR calculator takes a network in prefix notation and returns the network address, subnet mask, broadcast address, usable host range, and total address count, then tells you whether a given IP falls inside that block. Everything is computed locally in your browser.

How to use CIDR Subnet Calculator

  1. 1Enter a network in CIDR notation, such as 192.168.16.0/20.
  2. 2Review the network address, subnet mask, broadcast address, and usable host range.
  3. 3Enter an IP address below to instantly check whether it belongs to the block.

How do I do this in code?

Use the tool above for one-off work; for anything you repeat, move it into a script or your project.

# Requires ipcalc or sipcalc
ipcalc 192.168.16.0/20

# Python standard library
python3 -c "import ipaddress;n=ipaddress.ip_network('192.168.16.0/20');print(n.network_address,n.broadcast_address,n.num_addresses)"

Frequently asked questions

Why is the usable host count 2 less than the total?+

The first address in every block is the network address and the last one is the broadcast address, so neither can be assigned to a host. The exceptions are /31, which RFC 3021 reserves for point-to-point links, and /32, a single host; no addresses are subtracted in those two cases.

How many addresses are in a /20?+

A 20-bit prefix leaves 12 host bits, which works out to 4,096 addresses and 4,094 usable hosts, the equivalent of sixteen /24 networks. When planning internal ranges, round up to the next prefix that covers your expected host count so you keep room to grow without wasting a large block.

Related tools

All tools