Subnet Calculator (IPv4 / CIDR)
Free IPv4 subnet calculator. Enter an IP and CIDR or netmask to get network, broadcast, usable host range, total/usable hosts, binary view, and split subnets.
- Network Address
- —
- Broadcast Address
- —
- First Usable Host
- —
- Last Usable Host
- —
- Total Addresses
- —
- Usable Hosts
- —
- Subnet Mask
- —
- Wildcard Mask
- —
- Address Class
- —
- IP Type
- —
| # | Network Address | First Usable Host | Last Usable Host | Broadcast Address |
|---|---|---|---|---|
| Select a target prefix to see the subnet breakdown | ||||
IPv4 Subnet Calculator - CIDR, Netmask and Host Range
An interactive IPv4 subnet calculator that takes any address plus a CIDR prefix (or a dotted-decimal subnet mask) and shows the network address, broadcast, usable host range, total/usable hosts, wildcard mask, address class, and a colour-coded binary breakdown of the network and host bits. A built-in VLSM split table divides the network into equal-size subnets so you can plan address allocation in one click.
What is CIDR and how does it relate to a subnet mask?
CIDR (Classless Inter-Domain Routing) notation writes a network as IP/prefix, where the prefix is the number of leading 1-bits in the subnet mask. 192.168.1.0/24 means 'a network whose first 24 bits identify the network and the remaining 8 bits identify hosts.'
The equivalent dotted subnet mask has the first N bits set to 1: /24 → 255.255.255.0, /16 → 255.255.0.0, /8 → 255.0.0.0. CIDR replaced classful addressing (Class A/B/C with fixed boundaries) in the early 1990s, giving operators arbitrary block sizes. Most modern documentation, firewall rules, and routing tables use CIDR.
The calculator lets you enter either form — drag the CIDR slider, pick from the dropdown, or type a dotted netmask — and it keeps them in sync.
Why are 'total addresses' and 'usable hosts' different?
A subnet reserves two addresses for special purposes:
- Network address (all host bits = 0) — names the subnet itself.
- Broadcast address (all host bits = 1) — sends to every host on the subnet.
Neither can be assigned to an individual host on most equipment. So for a /24 with 256 total addresses, the usable host count is 256 − 2 = 254.
Two exceptions:
- /31 (RFC 3021): point-to-point links use both addresses for the two endpoints. Usable hosts = 2.
- /32: a single-host route. Usable hosts = 1 (the address itself).
The calculator handles these special cases automatically.
What's the difference between subnet mask and wildcard mask?
A subnet mask uses 1s to mark network bits and 0s to mark host bits. A wildcard mask is its bitwise inverse — 0s mark bits that must match, 1s mark bits that can vary.
Example for /24:
- Subnet mask: 255.255.255.0 (11111111.11111111.11111111.00000000)
- Wildcard: 0.0.0.255 (00000000.00000000.00000000.11111111)
Subnet masks appear in IP configuration on hosts, routers, and most firewalls. Wildcard masks are used by Cisco ACLs and OSPF area definitions to match ranges of addresses. The calculator shows both so you can paste whichever syntax your equipment expects.
What's the difference between Class A/B/C and CIDR?
Classful addressing (pre-1993) divided the IPv4 space by the first octet:
- Class A: 1.0.0.0 – 126.255.255.255 (default mask /8)
- Class B: 128.0.0.0 – 191.255.255.255 (default /16)
- Class C: 192.0.0.0 – 223.255.255.255 (default /24)
- Class D: 224.0.0.0 – 239.255.255.255 (multicast)
- Class E: 240.0.0.0 – 255.255.255.255 (reserved/experimental)
Classes are obsolete for routing — CIDR replaced them — but the labels still appear in documentation and exam material. The calculator reports the class of the input IP for educational purposes but the actual network boundaries are determined entirely by the CIDR prefix you pick, not by the class.
How does VLSM subnet splitting work?
VLSM (Variable Length Subnet Masking) means using different prefix lengths on different parts of a larger network. The 'Subnet Split' table in this calculator divides your current network into 2, 4, 8, … equal sub-networks by adding bits to the prefix.
Example: 192.168.1.0/24 split into /26:
- 192.168.1.0/26 (hosts .1–.62, broadcast .63)
- 192.168.1.64/26 (hosts .65–.126, broadcast .127)
- 192.168.1.128/26 (hosts .129–.190, broadcast .191)
- 192.168.1.192/26 (hosts .193–.254, broadcast .255)
VLSM is essential for efficient address allocation — you don't waste a /24 on a link that only needs 4 hosts. Real networks frequently mix /26s for office VLANs with /30s or /31s for router-to-router links.
What are the private IPv4 ranges?
RFC 1918 reserves three blocks for private networks — these addresses are not routed on the public internet and require NAT to reach external services:
- 10.0.0.0/8 (10.0.0.0 – 10.255.255.255) — ~16.7 million addresses
- 172.16.0.0/12 (172.16.0.0 – 172.31.255.255) — ~1 million addresses
- 192.168.0.0/16 (192.168.0.0 – 192.168.255.255) — ~65 thousand addresses
Plus a few related ranges:
- 127.0.0.0/8 — Loopback (always points to the local machine)
- 169.254.0.0/16 — Link-local (auto-assigned when DHCP fails)
- 224.0.0.0/4 — Multicast
- 100.64.0.0/10 — Shared address space (RFC 6598) used by CGN/ISPs
The calculator labels the IP Type so you can quickly tell which category your input falls into.
Can two different prefixes give the same subnet mask?
No — there is a one-to-one mapping between a valid CIDR prefix (0–32) and a dotted-decimal mask. Each prefix corresponds to exactly one bit pattern:
- /24 ↔ 255.255.255.0
- /25 ↔ 255.255.255.128
- /26 ↔ 255.255.255.192
- /30 ↔ 255.255.255.252
An invalid 'mask' like 255.0.255.0 has non-contiguous 1-bits and cannot be expressed as a CIDR prefix. The calculator rejects such masks because they would create routing tables that don't match real-world IP equipment. If you type one, you'll see an error and the existing values stay in place.
Is this calculator private and offline-capable?
Yes. The calculator runs entirely in your browser:
- Your input never leaves the device. You can verify by opening DevTools → Network while typing — no requests fire.
- No external libraries are loaded for the math. It's a single ~250-line vanilla JavaScript file.
- The page itself loads shared site assets (Bootstrap CSS, the framework's main.js, icon SVGs) once, then works offline for further calculations.
- The Copy button only writes to your local clipboard; there is no upload.
This matters when calculating subnets for production infrastructure where the address ranges themselves are sensitive (DMZ, management VLANs). Many online subnet calculators POST your input to a server; this one never does.
Key Features
- Calculate IPv4 network, broadcast, host range, and total/usable hosts
- Enter CIDR (0–32) via dropdown or slider, or type a dotted subnet mask
- Live two-way sync between CIDR prefix and dotted netmask
- Wildcard mask output for Cisco ACL / OSPF use
- Address class (A/B/C/D/E) and IP type (private, public, loopback, link-local, multicast)
- Colour-coded binary breakdown showing network vs host bits
- VLSM subnet split table — divide your network into 2, 4, 8, 16… equal subnets
- Special handling for /31 (RFC 3021 point-to-point) and /32 host routes
- Validates non-contiguous masks and rejects them
- Quick presets: /8, /16, /24, /30, /32
- Copy a full summary to clipboard
- 100% client-side — your inputs never leave your device
- No external libraries — works offline after first load
- Mobile-friendly and dark-mode aware
- Tested edge cases: /31, /32, private ranges, multicast, loopback
