Subnet Calculator — IPv4, CIDR & IPv6

Type an IP and a mask — as dotted decimal, CIDR prefix, or wildcard, whichever you have — and get the network, broadcast, and usable range with the binary math shown, not hidden. Then plan real networks: split a block into subnets visually, name them, export CSV. IPv6 prefix math included. Everything runs in your browser.

Subnetting in one line: the subnet mask splits an address into a network part and a host part — the network address is IP AND mask and the broadcast is the network with every host bit set to 1. A /24 leaves 8 host bits: 256 addresses, 254 usable.

IPv4 subnet calculator

Pick a prefix — or type a mask or wildcard below; all three stay in sync.

The mask math, bit by bit

■ network bits  ·  ■ host bits — the network address is the IP with every host bit forced to 0; the broadcast has them all forced to 1.

All subnet math runs in your browser — nothing about your network is sent anywhere, and the page works offline once loaded.

[ Ad slot — replace with AdSense / Ezoic code ]

Visual subnet splitter (VLSM planner)

Start from a block, click Split to halve any subnet, Join to merge halves back. Name subnets as you go and export the plan as CSV. This is how variable-length subnetting is actually done: keep splitting until each piece fits its network.

Each segment's width is proportional to its share of the block. Click a segment to highlight its row.
NameSubnetNetmaskUsable rangeUsable hosts

IPv6 subnet calculator

Paste any IPv6 address — abbreviated or full — with a prefix length. Get the expanded and canonical short forms, the network prefix, the address range, and a listing of child subnets inside the prefix.

Subnets inside this prefix

Full 128-bit math (BigInt) — no rounding. IPv4-mapped notation like ::ffff:192.0.2.1 isn't parsed here; use the plain hex form.

CIDR chart: every prefix from /0 to /32

Computed live by the same engine as the calculator — prefix, dotted mask, wildcard, and host counts side by side. The wildcard column is the mask inverted, which is the form router access-lists expect.

CIDRSubnet maskWildcardTotal addressesUsable hosts

Three rows deserve a flag: /32 is a single host route (1 address, and it's usable — it is the host). /31 is the point-to-point special case: RFC 3021 lets both addresses be used on a two-router link, so it has 2 usable hosts and no broadcast in the ordinary sense. Everything from /30 down follows the familiar "total minus 2" rule, because one address is the network identifier and one is the broadcast.

Mask ↔ CIDR ↔ wildcard, and why all three exist

They're the same information in three costumes. The CIDR prefix (/24) counts the network bits; the dotted mask (255.255.255.0) writes those bits out in decimal; the wildcard (0.0.0.255) is the mask with every bit flipped, a convention access-control lists adopted so that 0 means "must match" and 1 means "don't care." The calculator above accepts any of the three and keeps the other two in sync, because half of real-world subnetting friction is translating between a firewall that wants wildcards and documentation written in CIDR. One genuine trap: a valid subnet mask must be contiguous ones followed by contiguous zeros — 255.255.0.255 is not a mask, and the tool will tell you so rather than computing nonsense from it.

VLSM: subnetting a block into unequal pieces

Variable-length subnet masking is nothing more exotic than splitting a block unevenly: give the 500-host LAN a /23, the 50-host branch a /26, and the router links /30s (or /31s), all carved from one parent block. The classic paper method — sort requirements largest first, allocate from the top of the block, keep every subnet aligned to its own size — is exactly what the visual splitter above does when you click. Each split halves a subnet on its next bit boundary, so alignment errors, the way VLSM plans usually go wrong by hand, can't happen. Plan the big allocations first, keep splitting the remainder, name each piece, and export the CSV as your addressing document.

"What is my subnet mask?" — what a web page can and can't see

Honest answer: this page can't detect it. A browser tab is deliberately walled off from your network adapter's configuration — no website can read your LAN's subnet mask, and any page claiming to show it is showing your public IP (a different thing) or guessing. Your operating system knows, though, and asking it takes one command:

On a typical home network it's 255.255.255.0 (/24). Paste whatever the command shows into the calculator above to see the network it implies.

Sizing cloud VPC subnets

Cloud networks use the same CIDR math with one twist: the provider reserves a handful of addresses in every subnet for its own plumbing, so the usable count is lower than the classic "minus 2." In an AWS VPC, five addresses per subnet are reserved (network, broadcast, and three for the router, DNS, and future use) — a /24 there yields 251 usable hosts, not 254. Azure virtual networks reserve five as well. The general guidance is the same everywhere: check your provider's current reservation rules, size subnets with growth room (a /24 per subnet is a comfortable default when the block allows), and carve them from your block with the splitter above so nothing overlaps.

Why "Class A/B/C" is on the chart but off the menu

The calculator reports the historical class of an address because exam questions and old documentation still use the terms, but classful addressing has been obsolete since CIDR replaced it in 1993. Under the classful scheme the first bits of an address dictated its mask — class A meant /8, B meant /16, C meant /24 — which wasted enormous blocks and nearly exhausted the address space. CIDR made the prefix length explicit and arbitrary, which is why 10.0.0.0/22 is a perfectly normal network today even though "10." is a "class A" address. Treat the class label as trivia; the prefix is the truth.

Frequently asked questions

Why "usable hosts" is total minus 2 — and why /31 is different

In every ordinary subnet, the all-zeros host address names the network itself and the all-ones address is the broadcast, so neither can be assigned to a device: a /24's 256 addresses give 254 usable. The exception is /31: on a point-to-point link between two routers there's no need for a broadcast address, so RFC 3021 permits both addresses to be assigned — 2 addresses, 2 usable. A /32 is a single host route: 1 address, and it's the host. This calculator applies all three rules automatically.

What is a wildcard mask and when do I need one?

It's the subnet mask bitwise-inverted: /24's mask 255.255.255.0 becomes wildcard 0.0.0.255. Router and firewall access-lists historically use wildcard form, where a 0 bit means "this bit must match" and a 1 bit means "ignore this bit." Functionally it carries identical information to the mask — which is why typing either one here updates the other. Wildcards can also, on some platforms, be non-contiguous for exotic matching tricks; this tool sticks to the contiguous case, which is what subnetting means.

Is my IP address or network plan sent anywhere?

No. Every calculation on this page — IPv4, the splitter, IPv6 — is JavaScript running in your tab. There's no server call, and the page keeps working offline once loaded. That matters here: internal addressing plans are exactly the kind of thing that shouldn't be typed into a stranger's server.

Why does the calculator say my mask is invalid?

A subnet mask must be an unbroken run of 1-bits followed by an unbroken run of 0-bits — 255.255.240.0 is valid (/20); 255.240.255.0 is not, because its ones aren't contiguous. If you typed a value with a gap, the tool flags it instead of silently computing a meaningless network. If you meant to type a wildcard, use the wildcard field — it expects the inverted form.

How many /64s fit in my IPv6 allocation?

Two to the power of the difference. A /48 contains 216 = 65,536 /64 subnets; a /56 contains 256. Since a /64 is the standard size for any single LAN segment (SLAAC address autoconfiguration requires it), IPv6 planning is mostly deciding how to spend those 65,536 — the IPv6 module above lists them and jumps to any index.

[ Ad slot — replace with AdSense / Ezoic code ]

Related tools