IP Subnet Mask & CIDR Calculator

Network, broadcast, usable hosts and wildcard — plus how many IPs your cloud provider actually lets you use.

—
Embed this tool on your website / blog No code required · Copy and paste
HTML Embed Code (iframe):
<iframe src="https://lucentool.com/cidr-subnet" width="100%" height="650" style="border:1px solid #e5e0d8;border-radius:12px;max-width:850px;width:100%;" frameborder="0"></iframe>
<div style="font-size:12px;color:#78716c;margin-top:6px;font-family:sans-serif;">Powered by <a href="https://lucentool.com/cidr-subnet" target="_blank" style="color:#c85a32;text-decoration:none;">Lucentool - IP Subnet Mask & CIDR Calculator</a></div>

CIDR notation, explained

CIDR (Classless Inter-Domain Routing) describes a network with an IP plus a prefix length: 192.168.1.0/24 means the first 24 bits are the network and the remaining 8 bits are host addresses — 256 total addresses, of which 254 are usable (network + broadcast are reserved).

Cloud providers reserve even more

When you create a VPC subnet in the cloud, the provider takes some addresses for its own infrastructure:

A /24 in AWS therefore has only 251 usable addresses, not 254 — planning around that number prevents the classic "my subnet looks big enough but I can't fit another instance" surprise.

Quick reference

CIDRTotal IPsUsable (classic)AWS usable
/24256254251
/23512510507
/22102410221019
/20409640944091
/16655366553465531

What happens in the page

Every value is converted to a 32-bit integer first: ip2int() shifts the four octets into place, the subnet mask is built from the prefix length, and the network and broadcast addresses fall out of one bitwise AND and one bitwise OR with the inverted mask. int2ip() turns the results back into dotted notation for display. Doing the arithmetic on integers rather than strings is what makes the host range and the wildcard mask exact instead of approximated.

Where it breaks down

IPv4 only. IPv6 needs 128-bit arithmetic and a different display convention, which is a separate tool. The two small prefixes are special and are labelled as such: /31 is a point-to-point link where both addresses are usable, /32 is a single host with no broadcast address — the familiar "subtract two" rule does not apply to either. Private ranges are marked, but no routing or reachability is inferred, because a subnet calculation says nothing about what is actually connected.

Privacy: no data leaves this tab

IP addresses and masks are integers in memory; nothing is resolved, pinged or logged, so the network you are calculating about is never contacted.

Frequently asked questions

Why is the host count wrong for /31?

Because /31 is designed for point-to-point links: both addresses are assignable and there is no broadcast. The minus-two rule only holds for /30 and shorter prefixes.

Does it support IPv6?

No. IPv6 needs 128-bit arithmetic and a different notation; the calculator is deliberately IPv4-only so the numbers stay exact.

Can it tell me if a subnet overlaps another?

Not in this version. Overlap checking needs both ranges entered, which is a different workflow.