# IP Subnet Calculator — IPv4, IPv6 & VLSM

> Calculate network, broadcast, host range, mask, wildcard and usable hosts for any IPv4 or IPv6 CIDR. Split blocks into subnets and plan VLSM. Free, instant.

- **Category:** Others
- **Interactive calculator:** https://youcalc.com/en/others/ip-subnet-calculator/
- **Price:** Free, no sign-up required

## Overview

This IP subnet calculator turns any IPv4 or IPv6 address with a CIDR prefix into a full breakdown: the network address, broadcast address, first and last usable host, host range, netmask, wildcard mask, total and usable address counts, and whether the block is private or public. It also splits a block into subnets — either an equal split at a new prefix or a variable-length (VLSM) plan sized to a list of required host counts — so you can design an addressing scheme without manual bit math.

## How to read your result

Enter an address and a prefix length (the number after the slash). The breakdown card shows each derived field with a copy button. For IPv4, the netmask marks the network bits and the wildcard mask is its inverse; the usable host count is the total minus the network and broadcast addresses, except a /31 (2 usable, RFC 3021) and a /32 (1 usable). The binary grid highlights the network bits in colour and leaves the host bits plain. For IPv6 there is no broadcast and nothing is subtracted: the first address is usable and the total is 2 to the power of the host bits, shown both exactly and as a power of two. The split table lists every child subnet with its network, mask, range and usable count; huge splits are capped at 1024 rows but the total count is always exact.

## Method

IPv4 math is done on 32-bit unsigned integers. The netmask is 0xFFFFFFFF << (32 − prefix), coerced to unsigned, with a guard so that a /0 produces 0.0.0.0 (a 32-bit shift is identity in JavaScript). The network address is address AND mask; the broadcast is network OR the wildcard (NOT mask); usable hosts are 2^(32−p)−2 for prefixes up to /30, 2 for a /31 (RFC 3021) and 1 for a /32. Private status is tested against the RFC 1918 ranges 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. IPv6 math uses 128-bit BigInts end to end: the address is parsed by expanding "::" to eight groups (converting any embedded IPv4 dotted-quad first), the mask is built as all-ones XOR the host-bit ones, and the text form is canonicalized per RFC 5952 (lowercase, leading zeros dropped, the longest run of zero groups compressed to "::", leftmost on a tie, and never a single zero group). Subnet counts for a split are computed analytically as 2^(q−p) and never enumerated by loop.

## Example

- **Setup:** IPv4 address 172.16.5.130 with a /26 prefix.
- **Result:** The network is 172.16.5.128 and the broadcast is 172.16.5.191, so the usable hosts run from 172.16.5.129 to 172.16.5.190 — 62 usable out of 64 total. The netmask is 255.255.255.192, the wildcard mask is 0.0.0.63, and because 172.16.5.130 falls inside the RFC 1918 172.16.0.0/12 range it is a private address (Class B is shown for legacy reference only).

## Frequently asked questions

### Why does a /31 show 2 usable hosts instead of 0?

On point-to-point links, RFC 3021 allows both addresses of a /31 to be host addresses, with no network or broadcast reservation. The legacy formula 2^(32−p)−2 gives 0 for a /31, which is what many older tools still report. This calculator follows RFC 3021 and reports 2, and reports 1 usable host for a /32 (a single host route).

### What is the wildcard mask and when do I use it?

The wildcard mask is the bitwise inverse of the netmask: where the netmask has ones (network bits) the wildcard has zeros, and where the netmask has zeros (host bits) the wildcard has ones. It is used in Cisco access control lists and OSPF network statements to match a range of addresses.

### Is the IP class (A, B, C, D, E) still meaningful?

No. Classful addressing from RFC 791 was replaced by CIDR (classless inter-domain routing) in 1993. The class label is informational only — you should never derive the subnet mask, host count, or whether an address is private from the class. Private status comes from the exact RFC 1918 ranges (10/8, 172.16/12, 192.168/16), not from the first octet.

### How does VLSM differ from an equal split?

An equal split divides a parent block into same-size subnets at a single new prefix (for example a /24 into four /26s). VLSM (Variable-Length Subnet Masking) instead sizes each subnet to its own required host count. The calculator sorts the requirements largest-first, rounds each up to the smallest prefix that fits the hosts plus two (network and broadcast), and packs them on aligned power-of-two boundaries so no space is stranded.

### Does IPv6 have a broadcast address?

No. IPv6 has no broadcast address and no network/host-count subtraction. The first address of a prefix is usable, the last address is simply the host bits set to all ones, and the number of addresses in a prefix is 2 to the power of the host bits — which is why this tool computes IPv6 counts with arbitrary-precision (BigInt) math and can display values such as 2^64 exactly.

## Related calculators

- [Number Base Converter](https://youcalc.com/en/conversions-units/number-base-converter/)

## Sources

- https://datatracker.ietf.org/doc/html/rfc1918
- https://datatracker.ietf.org/doc/html/rfc3021
- https://www.rfc-editor.org/rfc/rfc4291
- https://www.rfc-editor.org/rfc/rfc5952
- https://www.rfc-editor.org/rfc/rfc4193
- https://jodies.de/ipcalc

---

Interactive version: https://youcalc.com/en/others/ip-subnet-calculator/ · From YouCalc — https://youcalc.com
