Subnet Calculator

How this calculator works

Enter an IPv4 address in CIDR notation (192.168.1.0/24) or with a dotted-decimal mask (192.168.1.0 255.255.255.0). The calculator returns the network address, broadcast address, usable host range, host count, netmask, wildcard mask, prefix length, and the network address in binary. It accepts any prefix from /0 to /32.

How CIDR maps to a netmask

CIDR notation collapses a 32-bit subnet mask into a single number: the count of leading 1 bits. /24 means the first 24 bits identify the network, the remaining 8 bits identify hosts within it. That works out to 255.255.255.0 and gives you 256 total addresses — 254 usable, since the first and last are reserved for the network and broadcast.

A /30 reserves 30 bits for the network and leaves 2 host bits — 4 total addresses, 2 usable. /31 is a special case from RFC 3021: on point-to-point links you can use both addresses (no broadcast). /32 describes a single host route.

VLSM in one paragraph

Variable-Length Subnet Masking (VLSM) divides a parent network into subnets of different sizes, instead of fixed equal-size blocks. You list the host counts you need; the calculator allocates each one to the smallest network that fits, walking the parent address space from the start. The classic example: split 10.0.0.0/16 to serve 300, 100, 50, 20 hosts and you get 10.0.0.0/23, 10.0.2.0/25, 10.0.2.128/26, 10.0.2.192/27 — every subnet aligned to its block boundary, no wasted addresses between them.

Worked example

Input 192.168.1.0/24:

  • Network: 192.168.1.0
  • Broadcast: 192.168.1.255
  • Usable range: 192.168.1.1 – 192.168.1.254
  • Hosts: 254
  • Netmask: 255.255.255.0
  • Wildcard: 0.0.0.255 (handy for Cisco ACLs)
  • Binary: 11000000.10101000.00000001.00000000

Wildcards are the bitwise inverse of the netmask. Cisco’s IOS ACL syntax expects them; if you ever wondered why a permit ip 10.0.0.0 0.255.255.255 any line covers all of 10.0.0.0/8, that’s why.

IPv6 mode

Switch to the IPv6 subnet tab to work with v6. Enter an address in CIDR notation (2001:db8::/32) or with a space-separated prefix (fe80:: 64). The :: shorthand for zero-runs is accepted on input and the calculator returns both the compressed form (2001:db8:abcd:12::) and the fully expanded form (2001:0db8:abcd:0012:0000:0000:0000:0000) alongside:

  • the last address in the range,
  • prefix length and total addresses (decimal and a 2^N compact form — a /64 covers 2^64 ≈ 1.8 × 10^19 addresses),
  • address type detection (Global unicast, Unique local, Link-local, Loopback, Documentation, Multicast, ULA, 6to4, IPv4-mapped, etc., per RFC 4291 / 6890).

Common v6 prefixes worth knowing: /127 for point-to-point (RFC 6164), /64 for a typical LAN subnet, /56 for a residential delegation, /48 for a site, /32 for an ISP allocation.

What this tool does not do

No VLSM splitter for IPv6 — variable-length subnetting is rare in v6 since /64 is the canonical subnet boundary. No save-by-URL or export. The math runs entirely in your browser; nothing is sent over the network.

Reference table

Prefix Netmask Wildcard Total addresses Usable hosts
/0 0.0.0.0 255.255.255.255 4,294,967,296 4,294,967,294
/1 128.0.0.0 127.255.255.255 2,147,483,648 2,147,483,646
/2 192.0.0.0 63.255.255.255 1,073,741,824 1,073,741,822
/3 224.0.0.0 31.255.255.255 536,870,912 536,870,910
/4 240.0.0.0 15.255.255.255 268,435,456 268,435,454
/5 248.0.0.0 7.255.255.255 134,217,728 134,217,726
/6 252.0.0.0 3.255.255.255 67,108,864 67,108,862
/7 254.0.0.0 1.255.255.255 33,554,432 33,554,430
/8 255.0.0.0 0.255.255.255 16,777,216 16,777,214
/9 255.128.0.0 0.127.255.255 8,388,608 8,388,606
/10 255.192.0.0 0.63.255.255 4,194,304 4,194,302
/11 255.224.0.0 0.31.255.255 2,097,152 2,097,150
/12 255.240.0.0 0.15.255.255 1,048,576 1,048,574
/13 255.248.0.0 0.7.255.255 524,288 524,286
/14 255.252.0.0 0.3.255.255 262,144 262,142
/15 255.254.0.0 0.1.255.255 131,072 131,070
/16 255.255.0.0 0.0.255.255 65,536 65,534
/17 255.255.128.0 0.0.127.255 32,768 32,766
/18 255.255.192.0 0.0.63.255 16,384 16,382
/19 255.255.224.0 0.0.31.255 8,192 8,190
/20 255.255.240.0 0.0.15.255 4,096 4,094
/21 255.255.248.0 0.0.7.255 2,048 2,046
/22 255.255.252.0 0.0.3.255 1,024 1,022
/23 255.255.254.0 0.0.1.255 512 510
/24 255.255.255.0 0.0.0.255 256 254
/25 255.255.255.128 0.0.0.127 128 126
/26 255.255.255.192 0.0.0.63 64 62
/27 255.255.255.224 0.0.0.31 32 30
/28 255.255.255.240 0.0.0.15 16 14
/29 255.255.255.248 0.0.0.7 8 6
/30 255.255.255.252 0.0.0.3 4 2
/31 255.255.255.254 0.0.0.1 2 2 (RFC 3021)
/32 255.255.255.255 0.0.0.0 1 1 (host route)