IP Subnet Calculator (CIDR / IPv4)
Enter an IPv4 address and a CIDR prefix to get the network and broadcast addresses, usable host range, host count, subnet mask, wildcard, IP class and address type — and split a block into equal subnets. Pure bit math, runs entirely in your browser, no signup.
How it works
A subnet calculator works on the 32-bit integer behind every IPv4 address. The dotted-decimal form 192.168.10.130 is really four 8-bit octets packed into one 32-bit number. The CIDR prefix (the /26 part) says how many leading bits identify the network; the rest identify the host. This is the classless model defined in RFC 4632, which replaced the older fixed Class A/B/C boundaries.
- Build the mask. A prefix of p sets the top p bits to 1:
mask = 0xFFFFFFFF << (32 − p). For/26that is 255.255.255.192. - Wildcard mask. Invert the mask:
wildcard = NOT mask— 0.0.0.63 for a /26. Cisco ACLs and OSPF statements match on this. - Network address.
network = IP AND mask. This zeroes the host bits, giving the first address in the block. - Broadcast address.
broadcast = network OR wildcard— the last address, where every host bit is 1. - Host count. A block holds
2^(32 − p)addresses. For prefixes /30 and shorter, two are reserved (network + broadcast), so usable hosts = 2^(32 − p) − 2. A /31 (RFC 3021) makes both addresses usable for point-to-point links, and a /32 is a single host route. - Address type. The tool tests the address against the IANA special-purpose ranges using the same AND-with-mask containment test: private (RFC 1918: 10/8, 172.16/12, 192.168/16), loopback (127/8), CGNAT (RFC 6598: 100.64/10), link-local (RFC 3927: 169.254/16), documentation (RFC 5737), multicast and reserved. Anything else is public.
Every result is verified two ways: the network address is computed once on the full 32-bit integer (IP AND mask) and once by masking each octet independently. The two paths must agree, and the calculator shows a “Cross-checked” badge when they do. JavaScript treats bitwise operands as signed 32-bit values, so each step is normalised back to unsigned, and the /0 case (which would otherwise hit a <<32 no-op bug) is handled explicitly.
Worked examples
Frequently asked questions
Sources & references
- RFC 4632 — Classless Inter-Domain Routing (CIDR)
- RFC 1918 — Address Allocation for Private Internets
- RFC 6598 — Shared Address Space (Carrier-Grade NAT)
- RFC 3927 — Dynamic Configuration of IPv4 Link-Local Addresses
- RFC 3021 — Using 31-Bit Prefixes on IPv4 Point-to-Point Links
- RFC 5737 — IPv4 Blocks Reserved for Documentation
- IANA — IPv4 Special-Purpose Address Registry
The mask table and special-purpose ranges on this page were last cross-checked against the RFCs and the IANA registry on 2026-06-08. They are reviewed whenever IANA updates the special-purpose registry.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.