IP Subnet Calculator

Calculate an IPv4 network, masks, address range and usable hosts, or an IPv6 prefix’s network, first and last address, address count and prefix list.

Network in CIDR notation192.168.1.0/24

Four decimal octets, for example 192.168.1.42.

bits

0 – 32 bits

Network in CIDR notation

192.168.1.0/24

  • Subnet mask255.255.255.0
  • Wildcard mask0.0.0.255
  • Broadcast address192.168.1.255
  • Usable address range192.168.1.1 – 192.168.1.254
  • Usable addresses254
  • Total addresses256

For /31, both addresses are usable on an RFC 3021 point-to-point link. /32 denotes one host. Other prefixes reserve the first and last addresses. This arithmetic does not determine routability, allocation rights or firewall policy.

How this was calculated

  1. Addresses in a /p block = 2^(32 − p)Put in your numbers: 2^(32 − 24) = 2^8Answer: 256 addresses
  2. Network = address AND subnet mask (clear the host bits)Put in your numbers: 192.168.1.42 AND 255.255.255.0Answer: 192.168.1.0
  3. Final address = network OR wildcard mask (set the host bits)Put in your numbers: 192.168.1.0 OR 0.0.0.255Answer: 192.168.1.255
  4. Usable addresses = block size − 2Put in your numbers: 256 − 2Answer: 254 (192.168.1.1 – 192.168.1.254)

Formula and method

A /p block has 2^(32 − p) addresses. Clear host bits for the network boundary. Ordinary subnets reserve network and broadcast addresses; /31 point-to-point links and /32 hosts are handled separately.

Worked example

192.168.1.42/24 belongs to 192.168.1.0/24. Its mask is 255.255.255.0 and ordinary usable addresses run from .1 through .254.

IPv6 prefixes

A /p IPv6 prefix contains 2^(128 − p) addresses. The network clears the last 128 − p bits and the last address sets them. IPv6 has no broadcast address, so all addresses are counted. Addresses are shown expanded and in the RFC 5952 compressed form, and the prefix list shows the networks containing the address at common lengths from /16 to /128.

Worked example: IPv6

2001:db8:85a3::8a2e:370:7334/64 belongs to 2001:db8:85a3::/64. The prefix runs from 2001:0db8:85a3:0000:0000:0000:0000:0000 to 2001:0db8:85a3:0000:ffff:ffff:ffff:ffff and holds 2^64 = 18,446,744,073,709,551,616 addresses.

Frequently asked questions

Why are there two usable addresses in a /31?

RFC 3021 permits both addresses on a point-to-point link. This does not mean every network type or device supports that configuration.

Why is a /64 the usual IPv6 subnet?

RFC 4291 uses 64-bit interface identifiers for most unicast addresses, so LAN segments are normally /64. Shorter prefixes such as /48 or /56 are typically delegated to sites and split into /64s.

References

Last updated . Results are estimates for informational purposes only.