IP Subnet Calculator

Calculate network, broadcast, usable host range and subnet mask from any IPv4 CIDR. Everything is computed in your browser.

100% client-side

Subnet input

Network bits Host bits

Results

Network address
Broadcast address
Usable host range
Usable hosts
Total addresses
Subnet mask
Wildcard mask
CIDR notation

How the subnet math works

An IPv4 address is a 32-bit number, usually written as four decimal octets. A CIDR prefix (/24) says how many of those 32 bits are fixed as the "network" portion; the remaining bits identify individual hosts inside that network. The network address zeroes out every host bit, and the broadcast address sets every host bit to 1:

192.168.1.10/24
→ Mask:       255.255.255.0   (24 network bits, 8 host bits)
→ Network:    192.168.1.0
→ Broadcast:  192.168.1.255
→ Usable:     192.168.1.1 – 192.168.1.254  (254 hosts)

The usable host count follows RFC 4632's formula 2^(32 - prefix) - 2, subtracting the network and broadcast addresses from the total block size. Two prefixes are special cases per RFC 3021: a /31 has exactly 2 usable addresses (no broadcast — both addresses in the block are valid hosts, meant for point-to-point links), and a /32 identifies exactly 1 host with no network or broadcast concept at all. This tool builds the address as a real 32-bit integer and runs the mask math with bitwise operators — no string-based octet arithmetic, which is where off-by-one errors on the /31 and /32 edge cases usually creep in.

Frequently asked questions

What does CIDR notation mean?

CIDR (Classless Inter-Domain Routing, RFC 4632) writes a subnet as an IP address followed by a slash and a prefix length, e.g. 192.168.1.0/24. The prefix length is how many leading bits of the 32-bit address are the network portion; the rest are host bits.

Why does a /31 subnet have no broadcast address?

RFC 3021 defines /31 as a special case for point-to-point links: both addresses in the 2-address block are usable as host addresses, since a link with only two devices doesn't need a separate broadcast address. A /32 similarly has no network or broadcast portion at all — it identifies exactly one host.

How is the number of usable hosts calculated?

For a /0 through /30 prefix, usable hosts = 2^(32-prefix) - 2, subtracting the network and broadcast addresses. /31 has exactly 2 usable addresses and /32 has exactly 1, as special cases.

Can I enter a dotted subnet mask instead of a CIDR prefix?

Yes. The prefix field accepts /24, 24, or 255.255.255.0 — all three are parsed and normalized to the same result.