Layerbit
Runs entirely in your browser

CIDR & Subnet Calculator

IPv4 and IPv6. Network, broadcast, host range, masks and address class from any CIDR — plus subnet splitting, membership checks and supernet aggregation, computed locally with exact 128-bit arithmetic.

Input
Accepts an address with a prefix length, an IPv4 address with a dotted mask, or a bare address (treated as /32 or /128).
Result
Waiting
Enter an address or CIDR block to begin.

What the numbers mean

A CIDR block such as 10.0.0.0/22 is an address plus a prefix length. The prefix length says how many leading bits are fixed — the network part — and the remaining bits vary across the hosts in the block. Everything this calculator shows follows from that one number, which is why it is worth being fluent in it rather than memorising a table.

Network and broadcast

The network address has every host bit set to 0; the broadcast address has every host bit set to 1. Neither can be assigned to a machine in IPv4. In a /22 the host part is 10 bits, so the block spans 1,024 addresses of which 1,022 are usable. IPv6 has no broadcast address: the all-ones address is an ordinary host, and the all-zeros "subnet-router anycast" address is reserved but routable.

Mask and wildcard

The netmask is the prefix length written as 32 bits: /22 is 255.255.252.0. The wildcard mask is its bitwise inverse, 0.0.3.255, and is what Cisco access lists and OSPF network statements expect. Getting these backwards is the single most common mistake in a hand-written ACL, and it fails silently by matching the wrong hosts.

Address classification

The result marks whether the address is private (RFC 1918 / RFC 4193 ULA), loopback, link-local, multicast, carrier-grade NAT (RFC 6598), documentation, or globally routable. The distinction matters when a block "works" on your LAN but cannot be reached from anywhere else — 100.64.0.0/10 is the classic surprise inside a cloud VPC.

Splitting a block

Choose a longer prefix and the block is divided into equal subnets: a /22 into four /24s, or into sixteen /26s. Each subnet is listed with its own network, host range and broadcast. This is the operation behind VPC subnet planning, and the table can be exported as CSV straight into a spreadsheet.

How the arithmetic is done

Every address is converted to an integer — 32 bits for IPv4, 128 bits for IPv6 — using JavaScript's BigInt, so IPv6 blocks are computed exactly rather than approximated with floating point. The network address is address AND mask, the broadcast is network OR NOT mask, and the size of the block is 2^(bits − prefix). A /48 in IPv6 contains 280 addresses, or 65,536 /64 subnets, and both figures are shown precisely.

Prefix-length ranges follow the specifications: 0–32 for IPv4 and 0–128 for IPv6. Host counts subtract two for IPv4 blocks of /30 and shorter, treat a /31 as two usable addresses per RFC 3021 (the point-to-point convention), and a /32 as a single host. IPv6 usable counts are the full block size, because RFC 4291 reserves nothing at the top of a subnet.

IPv4 prefix quick reference

PrefixMaskAddressesUsable hostsTypical use
/8255.0.0.016,777,21616,777,214An entire RFC 1918 range (10.0.0.0/8)
/16255.255.0.065,53665,534A cloud VPC, a campus
/22255.255.252.01,0241,022A large office subnet
/24255.255.255.0256254The everyday LAN
/26255.255.255.1926462A small VLAN, a cloud subnet per AZ
/28255.255.255.2401614A DMZ, a handful of servers
/30255.255.255.25242A traditional point-to-point link
/31255.255.255.25422A point-to-point link per RFC 3021
/32255.255.255.25511A single host route, a loopback

Three mistakes this tool is built to catch

Frequently asked questions

Two addresses in every IPv4 subnet of /30 or shorter are reserved: the first (all host bits zero) identifies the network itself, and the last (all host bits one) is the directed broadcast address. Neither can be assigned to an interface, so 256 becomes 254. The exception is a /31, which RFC 3021 defines as a two-address point-to-point link with no broadcast, so both addresses are usable.

No. IPv6 replaced broadcast with multicast. The all-ones address in a subnet is an ordinary assignable host address, and the all-zeros address is the subnet-router anycast address, which is reserved but still routes. That is why the calculator shows a broadcast row for IPv4 only, and why the usable count for an IPv6 block is the full block size.

They carry the same information in opposite polarity. A netmask has ones in the network bits (255.255.255.0 for a /24). A wildcard mask has ones in the host bits (0.0.0.255 for a /24) and is the form Cisco IOS access lists, OSPF and EIGRP network statements expect. The calculator shows both so you can paste whichever the device wants without inverting by hand.

65,536, because 64 minus 48 is 16 bits of subnet identifier and 2 to the power 16 is 65,536. A /56, the common residential allocation, holds 256 /64s. A /64 is the standard size for a single IPv6 LAN because SLAAC address autoconfiguration requires a 64-bit interface identifier; subnets smaller than /64 break it.

For IPv4: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (RFC 1918 private), 100.64.0.0/10 (RFC 6598 carrier-grade NAT), 127.0.0.0/8 (loopback), 169.254.0.0/16 (link-local), 224.0.0.0/4 (multicast), 240.0.0.0/4 (reserved), and the three documentation ranges 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24. For IPv6: ::1 (loopback), fc00::/7 (unique local), fe80::/10 (link-local), ff00::/8 (multicast), 2001:db8::/32 (documentation), ::ffff:0:0/96 (IPv4-mapped) and 2002::/16 (6to4).

No. The whole calculation runs in the page as JavaScript, and there is no server endpoint involved. You can confirm this by watching the Network tab of your browser's developer tools while you use the tool, or by loading the page and then disconnecting from the internet — it keeps working. Internal addressing plans are sensitive, and a subnet calculator is exactly the kind of tool that should never see them leave your machine.

Changelog