Others

IP Subnet Calculator

Work out the network, broadcast, host range, mask and usable hosts for any IPv4 or IPv6 CIDR — and split a block into subnets with VLSM.

Calculator

e.g. 192.168.1.0
/24
Network
192.168.1.0
192.168.1.0/24
Address breakdown
Network
Broadcast
Host range
Usable hosts254
Total addresses256
Netmask
Wildcard
ScopePrivate (RFC 1918)
ClassC (legacy)
Binary breakdown
192
168
1
0

Highlighted bits are the network portion; the rest are host bits.

Split into subnets (VLSM)

/26
4 subnets
#Network / CIDRMaskRangeUsable
1255.255.255.192192.168.1.1 – 192.168.1.6262
2255.255.255.192192.168.1.65 – 192.168.1.12662
3255.255.255.192192.168.1.129 – 192.168.1.19062
4255.255.255.192192.168.1.193 – 192.168.1.25462

How subnet math works

A CIDR prefix splits an address into a network portion (the high bits fixed by the mask) and a host portion (the low bits). The network address has all host bits zero; the broadcast address has them all one. Every address in between — minus the network and broadcast — is a usable host.

IPv6 has no broadcast address and no network/host-count subtraction: the first address of a prefix is usable and the count of addresses is simply 2 to the power of the host bits. A /31 (IPv4 point-to-point, RFC 3021) and a /32 (single host) are special-cased to 2 and 1 usable hosts.

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

On point-to-point links RFC 3021 lets both addresses of a /31 be host addresses, with no network or broadcast reservation. Older tools still apply the legacy 2^(32−p)−2 formula and report 0; this calculator follows RFC 3021.

What is the difference between the netmask and the wildcard mask?

The netmask marks the network bits (ones) and host bits (zeros); the wildcard mask is its bitwise inverse and marks the host bits with ones. Wildcard masks are used in ACLs and OSPF.

Is the IP class (A–E) still relevant?

No. Classful addressing (RFC 791) was superseded by CIDR in 1993. The class is shown for reference only — never derive the mask, host count, or whether an address is private from it. Private status comes from the RFC 1918 ranges.

How is VLSM different from an equal split?

An equal split divides a block into same-size subnets at one new prefix. VLSM (Variable-Length Subnet Masking) sizes each subnet to its required host count, allocating largest-first on aligned boundaries so no address space is wasted.

Results are estimates. Verify with a professional for important decisions.

About this calculator

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 results

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.

Worked example

IPv4 address 172.16.5.130 with a /26 prefix.

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.

How it's calculated

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.

Sources

Reviewed by the YouCalc Team · Last reviewed

Spot a translation issue, a calculation issue, or have a suggestion? Let us know.

200 more like this. Pick the next one.