IPv4 CIDR Calculator
Subnet calculator — parse CIDR, split, supernet, and test containment in your browser.
How to use IPv4 CIDR Calculator
- Paste a CIDR (`192.168.1.0/24`) or a bare IPv4 literal (treated as `/32`) into the top input.
- Read the Summary card for the mask, wildcard mask, network address, broadcast, first/last usable host, total + usable counts, and the private / loopback / link-local badges.
- Drag the Subnet / split slider to pick a longer prefix — the tool lists every equal-size subnet, capped at 1024.
- Paste an IP or CIDR into the Contains? box to test whether it falls inside the main block.
- Paste a second CIDR into Supernet to compute the smallest block that covers both.
- Click any Copy button to grab a single field, or Share to copy a URL that restores every input at once.
IPv4 CIDR Calculator
A client-side subnet calculator for IPv4 CIDR blocks. Paste a CIDR and get the mask, the wildcard mask, the network address, the broadcast, the first and last usable host, the total and usable counts, and the RFC-1918 / loopback / link-local classification — all with per-field copy buttons. Split a block into equal-size subnets, test whether an address falls inside, and compute the smallest supernet that covers two blocks. Everything runs as pure 32-bit integer arithmetic in your browser.
Why a dedicated CIDR calculator
Most IP-math cheat sheets stop at ip a / ifconfig. The moment you need to answer “is 203.0.113.45 inside 203.0.113.0/26?” or “what's the supernet of these two /24s?” you end up in a Python REPL with the ipaddress module, or — worse — an ad-heavy subnet-calculator site that exists to sell VPN subscriptions. This tool is the in-browser replacement for both. It ships the classic subnet summary (mask, wildcard, network, broadcast, first/last host, total/usable counts) plus three operations you actually need when you're debugging a routing issue at two in the morning:
- Split a parent block into equal-size subnets at any prefix (up to 1024 subnets — a soft cap so the browser stays responsive).
- Contains? test whether an IP or smaller CIDR falls inside the parent block.
- Supernet compute the smallest CIDR that covers two input blocks — the same operation BGP route aggregation performs.
What it does
- Strict parser. Rejects leading-zero octets (
01.0.0.0), out-of-range octets (256.0.0.0), stray dots, and bad prefixes. A bare IPv4 literal is treated as/32. - Summary card. Canonical CIDR, prefix length, subnet mask, wildcard mask, network address, broadcast, first/last usable host, total + usable counts, class (A/B/C/D/E), plus
Private,Loopback, andLink-localbadges. - RFC 3021 aware. A /31 reports two usable addresses, a /32 reports one — no off-by-two errors on point-to-point links.
- Subnet split. Slider + numeric input let you pick the new prefix; the tool lists every equal-size subnet (capped at 1024 for safety). One-click "Copy all" copies the full list as newline-separated CIDRs.
- Containment check. Accepts either an IPv4 literal or a smaller CIDR; a green or red badge flips live as you type.
- Supernet. The first CIDR is taken from the main input; type a second and the smallest covering block appears instantly.
- Shareable URLs. Every input (main CIDR, split prefix, contains value, supernet second CIDR) round-trips through the URL hash so you can bookmark or send a link that restores the whole view. Nothing is uploaded — fragments never leave the browser.
The math, in one paragraph
An IPv4 address is a 32-bit unsigned integer. The prefix mask for /p is p === 0 ? 0 : (0xffffffff << (32 - p)) >>> 0 — the leading p bits set, the rest cleared. The network address is address & mask, the broadcast is network | ~mask, and the total address count is 2 ** (32 - p). Containment between two CIDRs is (inner.network & outer.mask) === outer.network once inner.prefix >= outer.prefix. Supernet is the same check run in reverse: walk the prefix down from min(a.prefix, b.prefix) until both networks mask to the same integer. The whole module is ~180 lines of TypeScript with no runtime dependencies.
What's not supported (yet)
- IPv6. The address space is 128 bits and the notation rules are different enough to deserve a separate tool. Coming soon.
- Full WHOIS / ASN lookup. That needs a network call; this tool is deliberately offline-only.
- Variable-length subnet mask (VLSM) planning. Splitting into unequal-size subnets is a feature on the roadmap — right now every split produces equal-size pieces.
Related tools
- URL Parser — inspect URLs that carry IPv4 literals or port numbers.
- HTTP Status Codes — network-level error reference for the other half of your debugging session.
- User Agent Parser — decode the
User-Agentheader that often arrives alongside the source IP.
Privacy and trust
Every calculation in this tool is a pure bit-math call. The implementation is a single TypeScript module compiled into the page bundle; no API fires when you type; no analytics are sent on the addresses you paste. The share button encodes state into the URL fragment (#…), which browsers never transmit to servers by design — so even your copy-paste trail stays between you and the person you share with.
Frequently asked questions
What is CIDR notation?
CIDR — Classless Inter-Domain Routing — notation is the `address/prefix` form that replaced the old class A/B/C scheme in 1993 (RFC 4632). The prefix length is the number of leading bits that identify the network; everything after those bits is the host portion. `192.168.1.0/24` therefore means “the network whose top 24 bits are 11000000.10101000.00000001, leaving 8 bits — 256 addresses — for hosts”. CIDR matters because it lets you allocate arbitrary-size blocks (a /22 for 1024 hosts, a /29 for a point-to-point link) instead of being pinned to the 16,777,216-address class-A grid.
What's the difference between the subnet mask and the wildcard mask?
The subnet mask has 1s for the network bits and 0s for the host bits (for /24 that's `255.255.255.0`). The wildcard mask is the bit-wise inverse (`0.0.0.255`). Routing and firewall rules on Cisco IOS and a few other vendors prefer the wildcard form because it directly encodes “which bits are allowed to vary” — for example, an access-list match on `10.0.0.0 0.0.0.255` accepts anything in `10.0.0.0/24`. Linux iptables and most modern syntax accept the CIDR form directly so you rarely need to type a wildcard by hand, but they still show up in router configs and ACLs.
Why does a /31 have two usable hosts and not zero?
Historically every subnet reserved two addresses — the network address (all host bits 0) and the broadcast address (all host bits 1) — which meant a /31 had literally zero usable hosts. RFC 3021 (2000) relaxed this for point-to-point links: on a /31 both addresses are host-usable because the link only has two endpoints and there's no need for a distinct broadcast. This tool applies the RFC 3021 rule automatically, so `10.0.0.0/31` reports 2 total / 2 usable. For /32 the single address is trivially usable (it's a host route). For /30 and wider, the network and broadcast addresses are still reserved, giving `total − 2` usable hosts.
How is a supernet different from a subnet?
Subnetting splits a block into smaller pieces; supernetting merges blocks into a larger one. If you own `10.0.0.0/24` and `10.0.1.0/24`, the smallest CIDR that covers both is `10.0.0.0/23` — half the prefix, twice the address space. Supernets are useful for route summarisation (advertising one `/23` across BGP instead of two `/24`s) and for firewall rules where a single CIDR is simpler to read. The supernet is always the longest prefix whose mask makes both inputs land on the same network boundary — this tool computes it by walking the prefix down one bit at a time until the two networks match.
Why don't I see 169.254.0.0/16 in RFC 1918?
Because it isn't. RFC 1918 defines exactly three ranges for private addressing: `10.0.0.0/8`, `172.16.0.0/12`, and `192.168.1.0/24` (more precisely `192.168.0.0/16`). The 169.254.0.0/16 block is defined by RFC 3927 as “link-local” — addresses a host auto-configures when DHCP is unavailable. They aren't routable off the local segment, but they also aren't RFC 1918 private. This tool reports them with a dedicated `link-local` badge so you don't conflate the two.
Does this tool send my IP addresses anywhere?
No. Every calculation in this tool — parsing, masking, containment, splitting, supernet — is pure 32-bit integer arithmetic that runs in your browser. There's no API call when you type, no analytics on the addresses you paste, and no outbound request when you click Share. The share button encodes your inputs into the URL fragment (`#…`), which browsers never transmit to servers by design. Even the source registry in the bundle is a single TypeScript module — you can read the math in `transform.ts` on GitHub.