Tools

CIDR and subnet calculator

Type a CIDR block, an address with a prefix or a mask, and read the network, the range, the host count and the split.

Try:

What it computes. Give the calculator an address with a prefix length (192.168.17.100/20), an address followed by a dotted netmask (10.0.0.1 255.255.255.0), a bare address, or an IPv6 block (2001:db8::/60). It returns the network address, the netmask and its wildcard, the first and last address of the block, the broadcast address, the usable host range, the exact number of addresses, and the position of your address inside the block. For IPv6 it also writes the address out in full, shows the canonical compressed form, and counts the /64 subnets a block holds. Below the result, the split control divides the block into the subnets of any longer prefix and lists the first sixty-four.

The method. The prefix length is the number of leading one-bits in the mask, as RFC 4632 defines it: a /20 is a 32-bit mask whose top twenty bits are ones. The network address is the input AND the mask; the last address of the block is the network OR the inverted mask; the block holds two to the power of the host bits. Every address is handled as an exact integer, so an IPv6 block of 296 addresses is counted to the last digit rather than rounded. IPv6 text follows RFC 4291 §2.2 on the way in — the eight-group form, the :: shorthand standing for one or more zero groups, and the mixed form that ends in a dotted IPv4 address — and RFC 5952 on the way out: lowercase, the longest run of zero groups compressed, a single zero group left alone, and the IPv4-mapped prefix kept in mixed notation.

A worked example. Type 192.168.17.100/20. The mask for /20 is 255.255.240.0, so the network is 192.168.16.0 and the block runs to 192.168.31.255: 4,096 addresses, 4,094 of them usable once the network and broadcast addresses are set aside. The address you typed is the 357th in the block (position 356, counting from zero). Split that /20 into /24s and you get sixteen blocks of 256, from 192.168.16.0/24 to 192.168.31.0/24; your address falls in the second.

The edge cases. A /31 has two addresses and both are usable, because RFC 3021 reserves nothing on a point-to-point link; a /32 is a single host route with no network or broadcast address at all. A /0 is the default route and covers every address. An IPv6 block has no broadcast address, and the calculator says so rather than inventing one; it does reserve nothing from the host count either, but notes that the first address of a subnet is the subnet-router anycast. When you type an address whose host bits are not all zero, the result shows the block that contains it and tells you that the network address differs from your input — the way RFC 4291 §2.3 warns that 2001:0DB8::CD30/60 names a different prefix from 2001:0DB8:0:CD30::/60, because the first expands with the CD30 at the end. The legacy class letter is shown for IPv4 only as a label from the pre-CIDR era; nothing about the block depends on it.

What this tool cannot know. It reads what you type and nothing else: it does not look up who holds a block, whether an address is reachable, or what your router's actual mask is. It treats reserved and special ranges — private space, link-local, multicast, documentation prefixes — exactly like any other block, without flagging them. Hosts that an operating system or an appliance may reserve inside a subnet beyond the network and broadcast addresses are not subtracted. If a result matters, check it against the configuration of the device that will carry it.

Run the self-test

Runs the known-answer table on this page, in your browser, against the same engine you just used. The known-answer table holds thirty-four cases drawn from the worked examples of RFC 4632 and RFC 4291.

Method v1.0, 2026-11-13. Authorities: RFC 4632 (CIDR notation and block sizes), RFC 4291 §2.2–2.3 (IPv6 text forms and prefixes), RFC 5952 (the IPv6 form shown), RFC 3021 (/31 links).