CIDR & Subnet Calculator
IPv4 and IPv6. Network, broadcast, host range, masks and address class from any CIDR — plus subnet splitting, membership checks, supernets, a VLSM planner for IPv4 and IPv6, range to CIDR conversion and an overlap check, computed locally with exact 128-bit arithmetic.
- Waiting
- Enter an address or CIDR block to begin.
| Name | Hosts needed | Block | First host | Last host | Broadcast | Capacity | Spare |
|---|
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
| Prefix | Mask | Addresses | Usable hosts | Typical use |
|---|---|---|---|---|
/8 | 255.0.0.0 | 16,777,216 | 16,777,214 | An entire RFC 1918 range (10.0.0.0/8) |
/16 | 255.255.0.0 | 65,536 | 65,534 | A cloud VPC, a campus |
/22 | 255.255.252.0 | 1,024 | 1,022 | A large office subnet |
/24 | 255.255.255.0 | 256 | 254 | The everyday LAN |
/26 | 255.255.255.192 | 64 | 62 | A small VLAN, a cloud subnet per AZ |
/28 | 255.255.255.240 | 16 | 14 | A DMZ, a handful of servers |
/30 | 255.255.255.252 | 4 | 2 | A traditional point-to-point link |
/31 | 255.255.255.254 | 2 | 2 | A point-to-point link per RFC 3021 |
/32 | 255.255.255.255 | 1 | 1 | A single host route, a loopback |
Three mistakes this tool is built to catch
- A host address where a network was meant. Typing
192.168.1.37/24is legal, and the calculator tells you the block is actually192.168.1.0/24. Firewalls and routers vary in whether they accept the host form; some silently normalise it and others reject it, and a config that works on one vendor fails on the next. - Overlapping subnets. Use the membership check with the first address of a second block. If it is inside, the two overlap, and the longest prefix will win routing decisions in ways that are very hard to debug from symptoms.
- An aggregate that is not one. Two adjacent
/24s only form a/23when the first is aligned to an even boundary:10.0.2.0/24and10.0.3.0/24aggregate to10.0.2.0/23, but10.0.3.0/24and10.0.4.0/24do not. The supernet tool computes the smallest block that covers both and says whether it covers anything else as well.
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).
Each request is rounded up to the smallest block that holds it: for IPv4 that is the hosts plus the network and broadcast addresses, so 100 hosts need a /25 (126 usable) and a two-host link needs a /30, or a /31 if you tick the RFC 3021 option. The blocks are then placed largest first from the start of the parent block. Because every block size is a power of two and the sizes only shrink, each one starts on its own boundary with no gaps, and the space left at the end is listed as free CIDRs you can use later. If the requests do not fit, the planner says which subnet ran out of room and how many addresses were still needed, rather than producing a partial plan.
Give the planner an IPv6 parent, such as the /48 a provider assigns to a site, and for each site or segment the number of /64 subnets it needs (every IPv6 LAN is a /64). A site needing 200 /64s gets a /56, which holds 256; one needing 16 gets a /60. Ticking nibble boundaries rounds each block to a prefix divisible by four, so every allocation lines up with a hex digit, which keeps addresses readable and lets reverse DNS be delegated cleanly.
Type the first and last address into Range to CIDR list, for example 10.0.0.5 - 10.0.0.200. The tool returns the fewest CIDR blocks that cover exactly that range and nothing more (nine for that example), which is what firewall rules, security groups and allow-lists that only accept CIDR notation need. The Overlap and conflict check works the other way: paste the blocks already in use, optionally with a name on each line, and it reports duplicates, blocks that contain others and partial overlaps, then summarizes the list into the fewest covering CIDRs.
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
- v2.0.0 VLSM planner: give a parent block and the hosts each subnet needs, and get an aligned largest-first plan with spare hosts, a usage bar, the free space left and a CSV export; optional /31 point-to-point links. IPv6 planning in /64s with optional nibble alignment. Range to the minimal CIDR list. Overlap and conflict check for a list of named blocks, with a summarized list. "Show all" is greyed out when every subnet is already shown.
- v1.0.0 Initial release: IPv4 and IPv6 with exact 128-bit arithmetic, dotted-mask input, address classification, binary view, subnet splitting with CSV export, membership check and supernet aggregation.