Subnet Calculator
The Subnet Calculator does IPv4 and IPv6 CIDR math in your browser — network, broadcast, first and last usable host, usable host count, split-into-subnets, a VLSM planner, and a mode that checks an AI's answer by recomputing it locally.
How to Use
- 1
Enter an IP address with a prefix, for example 192.168.1.10/24 — or an IP with a dotted mask, for example 192.168.1.10 255.255.255.0. IPv6 works too: 2001:db8::1/64.
- 2
Read the full table: network address, broadcast address, subnet mask, wildcard mask, first and last usable host, total addresses, usable host count, CIDR notation, and the address class and type (private per RFC 1918, loopback, link-local, CGNAT).
- 3
Check the parsed input echoed above the results — a typo'd prefix (/24 vs /25) silently changes every value, so confirm it matches what you meant before trusting the table.
- 4
Use the binary view to see how the network address is the bitwise AND of the address and the mask, and the broadcast is the network OR'd with the inverted mask.
- 5
To carve a network up, switch to Split into subnets: enter the parent network and the new prefix — a /24 split into /26s gives four subnets of 62 usable hosts each (192.168.1.0/26, .64/26, .128/26, .192/26).
- 6
For uneven needs use the VLSM planner: enter each subnet's required host count and it allocates the smallest fitting subnet to each, largest first. To check an AI's answer, paste its claimed network, broadcast, first/last host and usable count into Verify an AI's answer and see each claim marked right or wrong.
Frequently Asked Questions
What is CIDR notation?
How many usable hosts are in a /24? A /26? A /16?
What is the difference between network, broadcast and usable addresses?
What is a wildcard mask and where is it used?
Why does /31 have 2 usable hosts?
How do I split a network into subnets?
What is VLSM?
Does this calculator support IPv6?
Is my IP address uploaded anywhere?
What is the difference between a private and a public address?
Generative Answer & AI Documentation
What is the Subnet Calculator?
The Subnet Calculator takes an IP address with a prefix length or a subnet mask — 192.168.1.10/24, 192.168.1.10 255.255.255.0, or an IPv6 address such as 2001:db8::1/64 — and returns the full table: network address, broadcast address, subnet mask, wildcard mask, first and last usable host, total addresses, usable host count, CIDR notation, and the address class and type (private per RFC 1918, loopback, link-local, CGNAT per RFC 6598). A binary view shows the address, mask, and network in dotted binary so you can see the AND operation that produces the network address. Three more modes sit on the same page: Split into subnets lists every subnet when a network is carved into smaller ones; the VLSM planner allocates the smallest fitting subnet to each of several host-count requirements, largest first; and Verify an AI's answer takes a claimed network, broadcast, first/last host and usable count, recomputes all five locally, and marks each claim correct or wrong. Everything is 32-bit integer math for IPv4 and exact BigInt arithmetic for IPv6, done in the tab.
Why use Subnet Calculator offline?
Subnet math is small, exact, and easy to get wrong by one address — and the cost of being wrong is a config that does not route. The two ways people get it wrong today are the two this page is built for. First, they paste a real internal range — a 10.x network, a VPC CIDR — into a server-side calculator, handing a stranger their network layout. Here the range never leaves the tab, because the calculation is local integer math and there is nothing to upload. Second, they ask an AI for the answer, and AI tools hallucinate subnet math constantly: a confident network address that is off by one, a broadcast that belongs to the next subnet, a host count that forgot the /31 exception. The Verify mode exists for exactly that moment — paste the AI's claims, and the page recomputes them deterministically and marks each one right or wrong. A calculator that only prints its own answer cannot catch someone else's mistake; this one can.
When should you use this tool?
Use it when you are sizing a VPC subnet and need the smallest prefix that fits N hosts; when you are carving a /24 into VLANs and need the four /26 ranges written out; when two ranges need merging and you must check whether they overlap (compute both, compare network and broadcast); when a router or firewall config needs the wildcard mask for an ACL; when an AI gave you subnet numbers for a design doc and you need to check them before the doc goes out; and when you are studying for a networking exam and want the binary view and the cheat sheet next to the answer. Do not use it to decide whether a range is routable on the internet — it classifies by RFC ranges only, and routability depends on your ISP and routing, not on the address.
Key Benefits
- The full table, not two numbers: network, broadcast, mask, wildcard, first/last usable host, total and usable counts, CIDR notation, class and type.
- Both input forms — address/prefix and address/dotted mask — plus real IPv6 support with exact BigInt arithmetic.
- Split-into-subnets mode that lists every subnet with its usable range, not just the count.
- VLSM planner that allocates the smallest fitting subnet per requirement, largest first, and reports unused addresses.
- Verify an AI's answer mode: paste claimed values, get each one marked correct or wrong against a local recomputation.
- Binary view and a /8–/32 cheat sheet on the page — the teaching material, next to the answer.
- Correct edge cases: /31 gives 2 usable hosts (RFC 3021) and /32 gives 1 — the classic error other calculators make.
- 100% private: real internal ranges never leave the tab, no signup, no limits.
Common Use Cases
- Carving VLANs: 192.168.1.0/24 split into /26s gives 192.168.1.0/26, 192.168.1.64/26, 192.168.1.128/26 and 192.168.1.192/26 — four VLANs of 62 usable hosts each, listed with their ranges in the Split tab.
- Sizing a VPC subnet: 50 hosts need a /26 (62 usable) — a /27 with 30 usable is too small. The VLSM planner makes the same call for several subnets at once: 10.0.0.0/24 with 50 + 20 + 10 hosts allocates 10.0.0.0/26, 10.0.0.64/27 and 10.0.0.96/28, leaving 144 addresses unused.
- Checking an AI's answer: an AI that claims 192.168.1.130/26 has broadcast 192.168.1.192 is wrong — the correct broadcast is 192.168.1.191, with network 192.168.1.128 and 62 usable hosts. Paste the claims into Verify mode and the page marks the broadcast wrong.
- Writing a firewall rule: 10.0.0.5/8 gives network 10.0.0.0, broadcast 10.255.255.255, mask 255.0.0.0 and wildcard 0.255.255.255 — the wildcard goes straight into the ACL.
- Learning the binary: 192.168.1.10 is 11000000.10101000.00000001.00001010, and AND-ing it with the /24 mask gives the network 192.168.1.0 — the binary view shows the operation, not just the result.
Developer Notes & Best Practices
The math is three operations. The network address is the bitwise AND of the address and the mask; the broadcast is the network OR'd with the inverted mask; the host count is 2^(32 - prefix). The mask for a prefix p is 32 - p zero bits after p one bits, and a dotted mask is accepted only if it is a run of ones followed by a run of zeros — 255.0.255.0 is rejected, not silently reinterpreted. Usable hosts are total minus 2 (network and broadcast excluded), with the two RFC 3021 exceptions: /31 has 2 usable hosts and /32 has 1, where first and last usable equal the network and broadcast. VLSM picks the smallest prefix whose usable count fits the requirement — for h hosts that is 32 - ceil(log2(h + 2)), with /31 for 2 hosts and /32 for 1 — sorts requirements largest-first, aligns each allocation to its block boundary, and reports the unused remainder. IPv6 uses BigInt throughout: the mask is (2^128 - 1) shifted left by 128 - prefix, the last address is network OR inverted mask, and the total is 2^(128 - prefix) rendered exactly — a /64 is 18,446,740,073,709,551,616 addresses, not a float approximation. All numbers quoted on this page were computed by the same code the tool runs and verified in Node: 192.168.1.130/26 gives network 192.168.1.128, broadcast 192.168.1.191, 62 usable; 10.0.0.5/8 gives 16,777,214 usable; the /24-to-/26 split gives four subnets; the VLSM example above allocates exactly as shown with 144 addresses unused; 2001:db8::1/64 gives network 2001:db8:: and last address 2001:db8::ffff:ffff:ffff:ffff.
CIDR cheat sheet — mask, total addresses, usable hosts
| Prefix | Subnet mask | Total addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /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 (single host) |
Worked example — 192.168.1.130/26
| Field | Value |
|---|---|
| Network address | 192.168.1.128 |
| Broadcast address | 192.168.1.191 |
| Subnet mask | 255.255.255.192 |
| Wildcard mask | 0.0.0.63 |
| First usable host | 192.168.1.129 |
| Last usable host | 192.168.1.190 |
| Total / usable | 64 / 62 |
| Binary (address) | 11000000.10101000.00000001.10000010 |
| Binary (network) | 11000000.10101000.00000001.10000000 |
VLSM worked example — 10.0.0.0/24, needs 50 + 20 + 10 hosts
| Subnet | Needs | Allocated | Usable range | Usable |
|---|---|---|---|---|
| LAN | 50 | 10.0.0.0/26 | 10.0.0.1 – 10.0.0.62 | 62 |
| Wi-Fi | 20 | 10.0.0.64/27 | 10.0.0.65 – 10.0.0.94 | 30 |
| IoT | 10 | 10.0.0.96/28 | 10.0.0.97 – 10.0.0.110 | 14 |
| Unused | — | 10.0.0.112 – 10.0.0.255 | — | 144 addresses |
- Confirm the parsed input echoed above the results before trusting the table: /24 vs /25 is one digit and halves the network.
- Size by usable hosts, not total addresses — a /27 holds 32 addresses but only 30 usable hosts, and a requirement of 31 hosts needs a /26.
- Keep subnets aligned: a /26 inside a /24 starts at .0, .64, .128 or .192. An allocation that starts at .32 is not a /26 at all.
- For VLSM, allocate largest-first (the planner does this) — allocating the small subnets first fragments the space and can strand addresses.
- Check overlap before merging configs: compute both networks and compare ranges — two ranges overlap if either network address falls inside the other range.
- Remember /31 is for point-to-point links only: both addresses are usable because there is nobody to broadcast to — do not assign a /31 to a LAN segment.
Common Mistakes
- Typing /24 when you mean /25 (or the reverse): one digit halves or doubles the network, and every value on the page changes with it — check the echoed parsed input.
- Counting the network and broadcast addresses as usable: a /24 has 256 addresses but only 254 usable hosts — the classic off-by-two.
- Treating /31 as 0 usable hosts: RFC 3021 gives /31 two usable hosts. Calculators that subtract 2 from every prefix get this wrong.
- Forgetting the wildcard is the inverse of the mask: the wildcard for /24 is 0.0.0.255, not 255.255.255.0 — pasting the mask into an ACL matches nothing.
- Assuming a private address is unreachable or a public one is reachable: RFC classification is not routability — a 10.x address can be reachable inside a VPN, and a public address can be firewalled off.
- Sizing by total addresses: a subnet for 30 hosts needs a /27 (32 total, 30 usable) — a /28 with 16 total cannot hold them, and the VLSM planner will refuse rather than guess.
Limitations
This calculator classifies addresses by their RFC ranges (private per RFC 1918, shared address space per RFC 6598, loopback, link-local, multicast, reserved) — it cannot tell you whether a range is actually routable on the internet, because routability depends on your ISP and routing, not on the address. IPv6 has no broadcast address, so only a last address is shown; a tool that shows an IPv6 broadcast is wrong. The split mode lists at most 1,024 subnets and shows the first 128 on the page — splitting a /0 into /32s is not a meaningful request and the page will not try to render four billion rows. VLSM allocates largest-first and does not re-pack or optimise around existing allocations; if a requirement does not fit, it says so rather than silently shrinking it. IPv4-mapped IPv6 forms (such as ::ffff:192.168.1.1) are not parsed.
Structured Input/Output Example
192.168.1.130/26
Network: 192.168.1.128 Broadcast: 192.168.1.191 Subnet mask: 255.255.255.192 (/26) Wildcard mask: 0.0.0.63 First usable: 192.168.1.129 Last usable: 192.168.1.190 Total addresses: 64 Usable hosts: 62 CIDR: 192.168.1.128/26 Class: C — Private (RFC 1918)
Related Tools
Unix Timestamp Converter
Unix timestamp converter: turn epoch seconds or milliseconds into local time, UTC, and relative times. Auto-detects seconds vs milliseconds.
Cron Expression Generator
Cron expression generator: build a valid 5-field crontab line from dropdowns, with a plain-English translation to verify the schedule before it runs.
RSA Key Generator
RSA key generator: RSA 2048/3072/4096, ECDSA and Ed25519 key pairs in your browser via Web Crypto — PEM, JWK and OpenSSH export, SHA-256 fingerprint.
Regex Tester
Regex tester: debug regular expressions with live match highlighting, match counts, and instant syntax feedback. Flags g, i, m, s supported.