Skip to main content
ilovecalcs logoilovecalcs.

Other · Live

IPv4 subnets, solved at the prompt.

A free IPv4 subnet calculator for network engineers. Enter any IPv4 address with a CIDR prefix or a dotted-decimal mask; get the network and broadcast addresses, the usable host range, total & usable host counts, the wildcard mask, and a bit-by-bit binary breakdown. Strict octet validation, /31 and /32 handled correctly.

Cheat sheetCIDR & mask

Inputs

IPv4 address & mask

Mask format

/
Notation
192.168.1.0/24
Class
C
Type
Private (RFC 1918)
~/subnet-calc · /24
live

network

192.168.1.0/24

192.168.1.1192.168.1.254 · broadcast 192.168.1.255

Total

256

Usable

254

Mask

/24

Network address
192.168.1.0
Broadcast address
192.168.1.255
First usable host
192.168.1.1
Last usable host
192.168.1.254
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
CIDR notation
192.168.1.0/24
Total hosts
256 addresses
Usable hosts
254 addresses
IP class
C
IP type
Private (RFC 1918)

binary breakdown

IP11000000.10101000.00000001.00001010
Mask11111111.11111111.11111111.00000000
Network11000000.10101000.00000001.00000000
Broadcast11000000.10101000.00000001.11111111
IP hex 0xC0A8010A
Mask hex 0xFFFFFF00

Field guide

How an IPv4 subnet actually works.

An IPv4 address is a 32-bit number written as four decimal octets (192.168.1.10). A subnet is a contiguous block of those addresses defined by a mask that splits each address into two parts: the network (the high bits, shared by every host in the subnet) and the host (the low bits, unique per device). CIDR notation (/24, /16, etc.) is just a count of leading 1-bits in the mask.

Network address & broadcast address

The network address is the IP with every host bit zeroed: it identifies the subnet itself and is not assignable to a device. The broadcast address is the IP with every host bit set to 1: a packet sent there reaches every host on the subnet. Both endpoints are reserved, which is why a normal subnet of total size 2^h (where h = 32 − prefix) has 2^h − 2 usable hosts.

network = ip AND mask
broadcast = network OR (NOT mask)

Worked example: 192.168.1.10 / 24

With a /24 mask, the first 24 bits are the network and the last 8 are host bits, giving 256 addresses in total, 254 of them usable.

  • IP · 11000000.10101000.00000001.00001010
  • Mask · 11111111.11111111.11111111.00000000 = 255.255.255.0
  • Network · 192.168.1.0
  • Broadcast · 192.168.1.255
  • Usable hosts · 192.168.1.1 192.168.1.254

The /31 and /32 special cases

A /32 is a single-host route; the address identifies exactly one device, so the "first host" and "last host" are both that address itself. A /31 would normally have 0 usable hosts, but RFC 3021 repurposed it for point-to-point links between two routers: both addresses are usable, no broadcast is reserved. This calculator follows that convention.

Wildcard mask

The wildcard mask is the bitwise inverse of the subnet mask (NOT mask) and is what Cisco ACLs, OSPF area definitions, and many other configurations actually consume. For /24 it is 0.0.0.255; the zeroes mark the bits that must match exactly, the ones mark bits that don't care.

Classful addressing and why it's legacy

Pre-1993 IPv4 used five rigid classes determined entirely by the leading bits of the first octet:

  • Class A: first octet 1–126 (default mask /8)
  • Class B: first octet 128–191 (default mask /16)
  • Class C: first octet 192–223 (default mask /24)
  • Class D: 224–239, multicast
  • Class E: 240–255, reserved

Classful routing was replaced by CIDR (Classless Inter-Domain Routing, RFC 4632) in 1993 because the rigid block sizes wasted enormous amounts of address space. Modern routing is purely prefix-length based; class labels survive only as a quick mental shorthand and as the label this tool reports for completeness.

Private & reserved ranges (RFC 1918 et al.)

  • 10.0.0.0/8 · private (RFC 1918)
  • 172.16.0.0/12 · private (RFC 1918)
  • 192.168.0.0/16 · private (RFC 1918)
  • 100.64.0.0/10 · CGNAT (RFC 6598)
  • 127.0.0.0/8 · loopback (RFC 1122)
  • 169.254.0.0/16 · link-local APIPA (RFC 3927)
  • 224.0.0.0/4 · multicast (RFC 5771)
  • 240.0.0.0/4 · reserved (RFC 1112)

Calculating the host count quickly

The number of host bits is h = 32 − prefix. Total addresses = 2^h. Usable for normal subnets (≤ /30) = 2^h − 2. As prefix length grows by one, the block size halves: /24 = 256, /25 = 128, /26 = 64, /27 = 32, and so on.

How this calculator validates input

  • Address must be exactly four numeric octets separated by dots; each octet must be 0–255.
  • CIDR prefix must be an integer 0–32.
  • Decimal masks must be a contiguous run of leading 1-bits followed by 0-bits; anything else (e.g. 255.0.255.0) is rejected.

Disclaimer

This is a maths tool, not a network audit. It tells you what a packet would do given the address and mask you typed; it does not know your routing table, your firewall, or whether the address you entered is actually reachable. For production network design, cross-check against your authoritative IPAM.

Reference

Subnet mask cheat sheet

CIDR prefix, dotted-decimal mask, wildcard mask, and host counts for every realistic IPv4 prefix length from /8 to /32.

usable = 2^h − 2 (h = 32 − prefix)
CIDRSubnet maskTotal hosts
/8255.0.0.016,777,216
/9255.128.0.08,388,608
/10255.192.0.04,194,304
/11255.224.0.02,097,152
/12255.240.0.01,048,576
/13255.248.0.0524,288
/14255.252.0.0262,144
/15255.254.0.0131,072
/16255.255.0.065,536
/17255.255.128.032,768
/18255.255.192.016,384
/19255.255.224.08,192
/20255.255.240.04,096
/21255.255.248.02,048
/22255.255.252.01,024
/23255.255.254.0512
/24255.255.255.0256
/25255.255.255.128128
/26255.255.255.19264
/27255.255.255.22432
/28255.255.255.24016
/29255.255.255.2488
/30255.255.255.2524
/31255.255.255.2542
/32255.255.255.2551