gizmobench

Subnet Calculator

Enter an address with a prefix or a netmask and get the network, broadcast, usable host range and total addresses at once. Handles the edge cases most calculators get wrong: /31 point-to-point links, /32 host routes, and /0.

Subnet calculatorEnter an address with a prefix or a netmask: 192.168.1.10/24 or 10.0.0.1 255.255.0.0
Address

CIDR prefix to subnet mask reference

Every IPv4 prefix length with its mask, host count and wildcard. Usable hosts excludes the network and broadcast addresses; /31 and /32 are the documented exceptions.

CIDRSubnet maskWildcardTotal addressesUsable hosts
/8255.0.0.00.255.255.25516,777,21616,777,214
/16255.255.0.00.0.255.25565,53665,534
/20255.255.240.00.0.15.2554,0964,094
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122 (RFC 3021 point-to-point)
/32255.255.255.2550.0.0.011 (single host route)

Common questions

What is the difference between a /24 and a netmask of 255.255.255.0?
Nothing. They are two notations for the same mask. The prefix counts the leading 1 bits; the netmask writes those bits out in dotted decimal. Both are accepted here, and both are shown in the results.
Why does a /24 have 254 usable hosts and not 256?
A /24 holds 256 addresses, but the first is the network address and the last is the broadcast address, so 254 remain for hosts. That subtraction applies to every prefix from /0 through /30.
What about /31 and /32?
They are the exceptions. A /32 is a single host route: one address, no network or broadcast. A /31 has two addresses and, under RFC 3021, both are usable on a point-to-point link; neither is reserved. This calculator reports 2 usable hosts for a /31 rather than the 0 that a naive formula gives.
What is the wildcard mask for?
It is the bitwise inverse of the netmask, and it is what Cisco access lists and OSPF network statements expect instead of a netmask. A /24 netmask of 255.255.255.0 has a wildcard of 0.0.0.255.
Which ranges count as private?
The RFC 1918 ranges (10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16) plus 127.0.0.0/8 for loopback and 169.254.0.0/16 for link-local. Anything else is routable on the public internet.
Is my address sent anywhere?
No. The whole calculation is integer arithmetic that runs in your browser. Nothing is uploaded, logged or stored on a server, which is worth knowing if you are working with internal addressing plans.

Exact. All addressing is computed with integer bit arithmetic, so network, broadcast, host range and mask are correct for every prefix from /0 to /32, including the /31 point-to-point and /32 host-route special cases.