Skip to main content
1+1
EN
All calculators

Categories

IP subnet calculator (IPv4 / IPv6)

/

Result

Fill in the fields to see your result.

How it works

A CIDR prefix like /24 means the first 24 bits of the address identify the network, and the remaining bits identify hosts within it. The subnet mask is simply that many 1-bits followed by 0-bits; ANDing an address with the mask zeroes out the host bits, giving the network address.

The broadcast address is the highest address in the block — the network address with every host bit set to 1. Every address strictly between the network and broadcast addresses is assignable to a host, except for two special cases: a /31 (two addresses, both usable, no broadcast — RFC 3021) and a /32 (a single host address).

IPv6 uses the same prefix-length logic but on 128-bit addresses instead of 32-bit ones, so the numbers involved are vastly larger — a single /64, the most common LAN prefix, already contains 2⁶⁴ addresses.

Formulas used

Subnet mask from prefix length

mask = (2^32 − 1) << (32 − prefix) [IPv4]

Network and broadcast address

network = address AND mask; broadcast = network OR (NOT mask)

Worked examples

192.168.1.10/24 — a typical home or small-office subnet

Network 192.168.1.0, broadcast 192.168.1.255, usable hosts 192.168.1.1 to 192.168.1.254 (254 addresses).

10.0.5.130/26 — a smaller carved-out subnet

Network 10.0.5.128, broadcast 10.0.5.191, 62 usable host addresses.

Assumptions and limits

  • IPv4 input must be in standard dotted-decimal form (four numbers 0–255 separated by dots).
  • IPv6 input accepts the standard colon-hex form, including a single "::" run of zero-suppression.
  • This performs address arithmetic only — it does not check whether an address is publicly routable or reserved for special use.

Frequently asked questions

Why does a /24 give 254 usable hosts, not 256?

A /24 has 2⁸ = 256 total addresses in the block, but the lowest (the network address) and the highest (the broadcast address) are reserved for identifying the subnet itself and sending to everyone on it, leaving 254 assignable to individual hosts.

What is a wildcard mask used for?

It is the bitwise inverse of the subnet mask, and some equipment (notably Cisco access-control lists and OSPF configuration) specifies address ranges using the wildcard mask instead of the subnet mask directly.

Updated