Subnet Calculator

Enter as IP/prefix, e.g. 10.0.0.1/8 or 172.16.5.0/20

Field Binary (network bits in blue, host bits in red)
Results are computed using standard IPv4 binary arithmetic per RFC 950, RFC 1519 (CIDR), and RFC 3021 (/31). IPv6 not supported.

What This Tool Does

This calculator takes an IP address and a subnet mask or CIDR prefix, and returns the network address, broadcast address, usable host range, and total number of usable hosts — for both IPv4 and IPv6.

You can also use this Inflation Calculator

How It’s Calculated

An IPv4 address has 32 bits total. The CIDR prefix (like /26) tells you how many of those bits belong to the network portion — the rest are host bits.

Total addresses in the block = 2^(host bits) Usable hosts = 2^(host bits) − 2 (subtracting the network and broadcast addresses)

Worked example: 192.168.10.0/26

  • Prefix /26 means 26 network bits, so 32 − 26 = 6 host bits
  • Total addresses: 2^6 = 64
  • Usable hosts: 64 − 2 = 62
  • Subnet mask: 255.255.255.192
  • Network address: 192.168.10.0 (the block start)
  • Broadcast address: 192.168.10.0 + 63 = 192.168.10.63
  • Usable host range: 192.168.10.1 to 192.168.10.62

Edge Cases and Special Rules

  • /31 networks: With only 2 addresses total and 0 bits left for host/broadcast separation, /31 doesn’t follow the usual “subtract 2” rule — per RFC 3021, both addresses are usable, typically for point-to-point links.
  • /32 networks: This represents a single host — a route to exactly one IP address, with no subnet in the traditional sense.
  • Classful addressing is legacy: Older Class A/B/C designations predate CIDR and are largely historical now — modern networks use CIDR notation regardless of an address’s original class.
  • VLSM (Variable Length Subnet Masking): Rather than using one fixed subnet size across a whole network, VLSM allows different subnets within the same network to have different prefix lengths, matching subnet size to actual host requirements instead of wasting address space.

IPv4 vs. IPv6 Subnetting

These work on similar principles but differ in scale and convention. IPv4 addresses are 32 bits, commonly expressed with dotted-decimal subnet masks (like 255.255.255.0) alongside CIDR notation. IPv6 addresses are 128 bits and almost universally use prefix-length notation alone (like /64) rather than an equivalent dotted mask format. IPv6 subnetting also has a strong convention of using /64 as the standard split point for most networks, rather than the tighter host-bit planning common in IPv4, since IPv6’s address space is vastly larger.

Who Uses This

  • Network administrators planning IP address allocation across an organization
  • Students studying for networking certifications like CCNA or Network+
  • IT professionals configuring routers, firewalls, or VLANs
  • Home lab and self-hosting enthusiasts setting up their own network segments

Subnet Mask vs. CIDR Notation

These express the same information in different formats. A subnet mask, like 255.255.255.192, spells out which bits are network bits using dotted-decimal notation. CIDR notation, like /26, states the same thing as a simple bit count. Both describe an identical network/host split — CIDR is just more compact, which is why it’s become the standard shorthand in modern networking documentation and configuration.

FAQ

What is CIDR?

Classless Inter-Domain Routing — a way of expressing network prefixes as a bit count (like /24) instead of a full dotted-decimal subnet mask.

What’s the difference between a subnet mask and CIDR notation?

They represent the same network/host split — a subnet mask uses dotted-decimal format, while CIDR uses a simple prefix number.

How many usable hosts does a /24 have?

254 — a /24 has 8 host bits (256 total addresses), minus 2 for the network and broadcast addresses.

What is VLSM?

Variable Length Subnet Masking — using different subnet sizes within the same network instead of one fixed size, to match address allocation to actual need.

Does IPv6 use subnet masks the same way as IPv4?

Not quite — IPv6 relies on prefix-length notation almost exclusively, rather than the dotted-decimal subnet masks common in IPv4.

Try It Above

Enter an IP address and subnet mask or CIDR prefix in the calculator above to get the network details instantly. Results are for general networking reference only.