Subnet & CIDR Calculator (IPv4/IPv6) — Network, Wildcard, VLSM
Free online subnet calculator: enter an IP or CIDR to get network, broadcast, first/last usable, host count, wildcard mask, and CIDR ↔ subnet mask conversions. Includes IPv6 prefix range preview and a VLSM subnetting helper. Copy, export, print, and share.
Advanced: VLSM helper (IPv4)
🧭 Overview
This IP / Subnet / CIDR Calculator instantly converts between CIDR notation and dotted subnet masks, and computes the network address, broadcast address (IPv4), first/last usable IP, usable host count, and wildcard mask for ACLs. It supports IPv4 and IPv6, plus a practical VLSM (Variable Length Subnet Masking) helper for planning subnets.
Typical searches this tool answers: subnet calculator, CIDR calculator, CIDR to subnet mask, wildcard mask calculator, IPv6 prefix calculator, VLSM calculator, how many hosts in /26, what is my network address.
⚡ Quick Start
- Paste an IP as
address/prefix(e.g.,192.168.1.10/24or2001:db8::/48) or enter the IP and provide a dotted mask (255.255.255.0) or/prefixin the mask box. - Click Calculate / Update. The result table shows network, broadcast, usable range, wildcard, and host counts.
- Open Advanced → VLSM helper to split a parent network into equal subnets or per-subnet host requirements.
- Use Copy, Export to TXT, Print/PDF, or Share Link to save or share.
⚙️ How This Tool Works
- IPv4 math: Convert IP to a 32-bit integer. Subnet mask from prefix:
(0xFFFFFFFF << (32 − p)) & 0xFFFFFFFF. Network =ip & mask. Broadcast =network | (~mask). - Usable range (IPv4): For
/0…/30, usable hosts =2^(32 − p) − 2, first IP =network + 1, last IP =broadcast − 1. Special cases:/31has 2 usable (point-to-point, no broadcast);/32has 1 host. - Wildcard (IPv4): The ACL wildcard is the bitwise NOT of the mask; e.g.,
255.255.255.0 → 0.0.0.255. - IPv6: No broadcast/usable concept. We show the prefix start and prefix end by setting host bits to 0/1 using 128-bit arithmetic (
BigInt). - VLSM (IPv4): For equal splits, we add bits to the parent prefix. For a host list, we pick the smallest prefix that fits each request (largest first), align to block boundaries, and step through the parent space.
🧮 Subnet Formulas (Reference)
IPv4 mask from prefix p (0 ≤ p ≤ 32): mask = (0xFFFFFFFF << (32 - p)) & 0xFFFFFFFF Network & broadcast (IPv4): network = ip & mask broadcast = network | (~mask) Wildcard (IPv4 ACL): wildcard = (~mask) & 0xFFFFFFFF Usable host count (IPv4): if p ≤ 30: hosts = 2^(32 - p) - 2 if p = 31: hosts = 2 (point-to-point) if p = 32: hosts = 1 (single host) VLSM: smallest prefix for N hosts (IPv4): if N = 1 → /32 if N = 2 → /31 else → p = 32 - ceil(log2(N + 2)) // +2 for net/bcast
📒 IPv4 CIDR Cheat Sheet
| /p | Subnet Mask | Wildcard | Block Size (IPs) | Usable Hosts* |
|---|---|---|---|---|
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 (ptp) |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
*Usable hosts follow traditional rules; /31 has 2 usable (RFC 3021), /32 is a single host.
🧬 IPv6 Prefix Guide (No Broadcast)
IPv6 uses 128-bit addresses and has no broadcast. Most LANs allocate /64; organizations commonly receive /48 or /56.
| Prefix | Typical Use | Address Space |
|---|---|---|
| /32 | ISP allocation | 296 addresses |
| /48 | Org/site allocation | 280 addresses (65,536 × /64) |
| /56 | SMB/site, some ISPs | 272 addresses (256 × /64) |
| /64 | Single subnet (LAN) | 264 addresses |
| /127 | Point-to-point | 2 addresses |
| /128 | Single host | 1 address |
Special ranges: Link-local fe80::/10, Unique-Local fc00::/7 (commonly fd00::/8), Documentation 2001:db8::/32.
🧪 Worked Examples
1) IPv4 with CIDR
Input: 192.168.1.10/24 Mask: 255.255.255.0 Net: 192.168.1.0 Bcast: 192.168.1.255 First: 192.168.1.1 Last: 192.168.1.254 Hosts: 254 Wildcard: 0.0.0.255
2) IPv4 with dotted mask
Input: 172.16.5.20 Mask: 255.255.255.224 (/27) Net: 172.16.5.0 Bcast: 172.16.5.31 Usable: 172.16.5.1 – 172.16.5.30 (30 hosts) Wildcard: 0.0.0.31
3) IPv4 /31 point-to-point
Input: 10.0.0.0/31 Usable IPs: 10.0.0.0 and 10.0.0.1 (2 usable, no broadcast)
4) VLSM hosts list
Parent: 192.168.10.0/24 Requests (hosts): 60, 30, 10 Assigned: 60 → 192.168.10.0/26 usable 62 30 → 192.168.10.64/27 usable 30 10 → 192.168.10.96/28 usable 14 Remaining space continues from 192.168.10.112/28 ...
5) IPv6 prefix preview
Input: 2001:db8::/48 Start: 2001:db8:: End: 2001:db8:0:ffff:ffff:ffff:ffff:ffff (No broadcast in IPv6)
🧩 Popular Use Cases
- Designing VLANs and LAN segments with the right host capacity.
- Allocating router point-to-point links with
/31(IPv4) or/127(IPv6). - Generating ACL wildcard masks for firewalls and routers.
- Planning IPv6 addressing at
/48,/56, and/64boundaries. - Teaching subnetting, CIDR aggregation, and VLSM to students.
❓ FAQs
What is CIDR notation?
address/prefix, where prefix is the number of network bits. Example: 192.168.1.10/24 means a 24-bit mask 255.255.255.0.How do I convert CIDR to subnet mask?
/26 → 255.255.255.192. The wildcard is 0.0.0.63.What is a wildcard mask and why is it used?
10.1.2.0 0.0.0.255.Why do /31 and /32 behave differently?
/31 is for point-to-point links (RFC 3021) and has 2 usable addresses with no concept of a broadcast. /32 is a single host route (one IP).Does IPv6 have broadcast, network, or usable addresses?
/64 for subnets, link-local fe80::/10, and multicast.How do I choose a prefix for N hosts?
p = 32 − ceil(log2(N + 2)), except N=1 → /32, N=2 → /31.What are private, loopback, link-local, and CGNAT ranges?
- Private (RFC1918):
10/8,172.16/12,192.168/16 - Loopback:
127/8 - Link-local (APIPA):
169.254/16 - CGNAT:
100.64/10 - Documentation:
192.0.2/24,198.51.100/24,203.0.113/24
What is supernetting / aggregation?
/25 nets combine into one /24) if they are contiguous and aligned on the relevant boundary.Why is my dotted mask “invalid (non-contiguous)”?
255.255.0.255.How many subnets do I get if I split a /24 into /27s?
/27 has 32 IPs. A /24 has 256 IPs → 256 / 32 = 8 subnets.How do I find “the next network” after mine?
current_network + block_size, where block_size = 2^(32 − p) for IPv4.Should I use /127 on IPv6 point-to-point links?
/127 for IPv6 P2P to avoid ND issues and reduce attack surface. Alternatives like /64 on P2P still work but are less tight.What are common multicast and reserved IPv4 ranges?
224/4, Reserved/broadcast legacy behaviors around 0/8 and 255.255.255.255. The calculator flags the common special ranges but still computes the math.Is this calculator accurate for very large or very small prefixes?
Can I share my calculation?
🧯 Troubleshooting
- “Invalid IPv4 address” — check octets are 0–255 with no leading/trailing spaces.
- “Invalid dotted subnet mask” — mask must be contiguous 1-bits (e.g.,
255.255.0.255is invalid). - Overlapping VLSM outputs — ensure the parent prefix is large enough; the tool allocates largest requests first and aligns to block boundaries.
- IPv6 needs a prefix — include
/64,/56, etc. Dotted masks don’t apply to IPv6.
📚 Glossary
- CIDR — Classless Inter-Domain Routing;
address/prefixnotation. - Subnet mask — a dotted decimal mask for IPv4 (e.g.,
255.255.255.0). - Wildcard mask — inverse of subnet mask, used by ACLs.
- Network address — all host bits zero.
- Broadcast address (IPv4) — all host bits one (not used for
/31). - VLSM — Variable Length Subnet Masking; allocating different-sized subnets from one parent.
📚 Data Sources & Attribution
- RFC 4632 — Classless Inter-Domain Routing (CIDR) for IPv4
- RFC 3021 — Using 31-Bit Prefixes on IPv4 Point-to-Point Links
- RFC 4291 — IPv6 Addressing Architecture
- RFC 4193 — Unique Local IPv6 Unicast Addresses
- RFC 6890 — Special-Purpose Address Registries
- RFC 1918 — Address Allocation for Private Internets