Subnet Calculator
A fast IPv4 and IPv6 subnet / CIDR calculator. Enter an IP address plus a CIDR prefix or dotted subnet mask and the network and broadcast address, usable host range, wildcard mask, address counts and a binary breakdown update live. It also converts a CIDR to its IP range, finds the smallest CIDR that encloses two addresses, and splits a block into equal VLSM subnets — all computed in your browser.
Runs entirely in your browser — nothing you type is sent to a server. Every calculation here is plain client-side arithmetic (32-bit integers for IPv4, BigInt for IPv6). No addresses, masks or ranges leave this page.
What this tool is
- A free, in-browser subnet / CIDR calculator for both IPv4 and IPv6 — enter an IP plus a CIDR prefix or dotted subnet mask and the network, broadcast, mask, wildcard, host range and address counts update live.
- Accepts the mask either way: a prefix like /24 or a dotted mask like 255.255.255.0, and converts between them.
- Handles the edge cases correctly: /31 is an RFC 3021 point-to-point link (2 usable, no broadcast) and /32 is a single host.
- Extra helpers: convert a CIDR to its IP range, find the smallest CIDR that encloses two IPs, and split a block into equal VLSM subnets.
- IPv6 uses BigInt maths for exact 128-bit address counts (a /64 holds 2^64 = 18,446,744,073,709,551,616 addresses).
- Everything is deterministic and client-side — nothing you enter is sent to a server.
How subnetting and CIDR work
An IPv4 address is 32 bits, usually written as four dotted octets (e.g. 192.168.1.10). A subnet mask splits those 32 bits into a network portion (the leading 1-bits) and a host portion (the trailing 0-bits). CIDR notation records the split as a single number — the prefix length — so /24 means the first 24 bits are the network. IPv6 works the same way with 128-bit addresses and prefixes up to /128.
Network address — IP bitwise-AND mask. The all-host-bits-zero address that names the subnet.
Broadcast address — the all-host-bits-one address; a packet here reaches every host on the subnet (IPv4 only).
Usable hosts — everything between network and broadcast: 2^(32 − prefix) − 2 for IPv4 /30 and larger.
Wildcard mask — the inverse of the subnet mask, used in Cisco ACLs and OSPF.
Host counts by prefix (IPv4)
| Prefix | Mask | Total | Usable |
|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2 (RFC 3021) |
| /32 | 255.255.255.255 | 1 | 1 |
Public vs private ranges
Three IPv4 ranges (RFC 1918) are reserved for private networks and never routed on the public internet; the calculator flags which one an address falls in:
10.0.0.0/8— 16,777,216 addresses172.16.0.0/12— 1,048,576 addresses192.168.0.0/16— 65,536 addresses- Plus loopback
127.0.0.0/8, link-local169.254.0.0/16and CGNAT100.64.0.0/10. IPv6 uses unique local addresses infc00::/7.
Worked examples
192.168.1.0/24A typical home/office LAN: mask 255.255.255.0, broadcast 192.168.1.255, 254 usable hosts from .1 to .254.
10.0.0.0/8The largest RFC 1918 private block: 16,777,214 usable hosts — often carved into smaller subnets with VLSM.
192.168.1.10/31An RFC 3021 point-to-point link: exactly 2 usable addresses (.10 and .11), no broadcast address wasted.
203.0.113.0/30A /30: 4 total addresses, 2 usable (.1 and .2) — the classic size for a router-to-router link before /31 adoption.
2001:db8::/64The standard IPv6 LAN prefix: 2^64 addresses (18.4 quintillion) in a single subnet.
References: CIDR (RFC 4632), private address space (RFC 1918), /31 point-to-point links (RFC 3021), IPv6 addressing architecture (RFC 4291) and IPv6 canonical text representation (RFC 5952). This tool is an independent implementation for learning and day-to-day network work.
Frequently asked questions
How do I calculate a subnet?
Take the IP address and the subnet mask (written either as a CIDR prefix like /24 or a dotted mask like 255.255.255.0). The prefix is the number of leading 1-bits in the mask, which marks the network portion of the address; the remaining bits are the host portion. Perform a bitwise AND of the IP and the mask to get the network address, set all host bits to 1 to get the broadcast address, and the usable hosts are every address in between. For a /24 that is 2^(32-24) = 256 total addresses, 254 usable (one each reserved for the network and broadcast address). Enter the IP and mask above and this calculator does all of that instantly for both IPv4 and IPv6.
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation writes a network as an IP address followed by a slash and a prefix length — for example 192.168.1.0/24. The prefix length is how many bits, from the left, are fixed as the network portion; the rest are available for hosts. A smaller number means a bigger network: /24 is 256 addresses, /16 is 65,536, /8 is over 16 million. CIDR replaced the old fixed Class A/B/C scheme so address blocks can be sized to need. The same notation applies to IPv6, where prefixes run from /0 to /128 and /64 is the standard size for a single LAN.
What is the difference between a subnet mask and a wildcard mask?
A subnet mask (e.g. 255.255.255.0) has 1-bits for the network portion and 0-bits for the host portion. A wildcard mask is its bitwise inverse (0.0.0.255 for a /24) — 0-bits mean "must match" and 1-bits mean "don't care". Subnet masks are used in interface and routing configuration; wildcard masks appear in Cisco ACLs and OSPF network statements. This calculator shows both for every IPv4 network so you can copy whichever the tool in front of you expects.
Which IP ranges are private (RFC 1918)?
Three IPv4 ranges are reserved for private networks and are never routed on the public internet: 10.0.0.0/8 (10.0.0.0–10.255.255.255), 172.16.0.0/12 (172.16.0.0–172.31.255.255) and 192.168.0.0/16 (192.168.0.0–192.168.255.255). Also commonly seen are 127.0.0.0/8 (loopback), 169.254.0.0/16 (link-local / APIPA) and 100.64.0.0/10 (carrier-grade NAT, RFC 6598). The IPv6 equivalent of private addressing is unique local addresses in fc00::/7 (usually fd00::/8). This calculator flags which range an IPv4 address falls in.