DevBox Fast developer utilities, no signup

Subnet Calculator

Enter a CIDR block and every value updates as you type — network and broadcast addresses, subnet and wildcard masks, and the usable host range. Nothing you type ever leaves your browser.

Work out a subnet from its CIDR block

An IPv4 address is just a 32-bit number written as four dot-separated bytes. This tool packs your address into that 32-bit integer, builds a mask from the prefix length after the slash (a run of 1 bits equal to the prefix length, followed by 0s), and does two bitwise operations: AND the address with the mask to get the network address, and OR the network address with the mask's complement (the wildcard mask) to get the broadcast address. Every host address in between is usable, except the network and broadcast addresses themselves — with two RFC-defined exceptions: a /31 has no spare bits for either, so both addresses are usable host addresses (RFC 3021), and a /32 has no host bits at all, so it names exactly one address.

Worked example

192.168.1.0/24 has a 24-bit mask, 255.255.255.0, leaving 8 host bits — 256 total addresses:

Now shrink it to 10.0.0.0/30 — a 30-bit mask leaves only 2 host bits, or 4 total addresses: network 10.0.0.0, broadcast 10.0.0.3, and just two usable hosts, 10.0.0.1 and 10.0.0.2 — the smallest subnet that still follows the ordinary network/broadcast rule. One bit smaller, at /31, the rule changes entirely: RFC 3021 makes both addresses in the block usable hosts instead.

Frequently asked questions

What does the /24 in an address like 192.168.1.0/24 mean?

It's the prefix length: the number of leading bits (out of 32) that are fixed as the network portion, with the rest free for hosts. /24 fixes the first 24 bits — the first three octets — which is exactly a subnet mask of 255.255.255.0 and leaves 8 host bits, or 256 total addresses. A smaller number after the slash means fewer network bits and a bigger subnet; a larger number means more network bits and a smaller one.

Why are /31 and /32 handled differently from every other prefix?

A /32 has zero host bits, so it identifies exactly one address with no room for a separate network or broadcast address — it's used for host routes, not subnets. A /31 has exactly one host bit, which historically left zero usable addresses under the classic network+1..broadcast-1 rule; RFC 3021 fixed that for point-to-point links by declaring both addresses in a /31 usable, with no address reserved for network or broadcast. This tool follows RFC 3021 for /31 and treats /32 as a single host.

What's the difference between the subnet mask and the wildcard mask?

They're bitwise complements of each other. The subnet mask (255.255.255.0 for a /24) has 1s over the network bits and 0s over the host bits — it's what you'd type into a router's IP configuration. The wildcard mask (0.0.0.255 for that same /24) is the opposite: 0s over the network bits and 1s over the host bits. Cisco ACLs and OSPF network statements ask for the wildcard mask specifically, which trips people up if they paste in the subnet mask by habit.

Does this work for IPv6?

No — this tool is IPv4-only. The math here relies on packing a dotted-decimal address into a single 32-bit integer, which is a good fit for IPv4 but doesn't extend to IPv6's 128-bit address space or its colon-hex notation. An IPv6 subnet calculator needs different math entirely, not just a wider integer.