Skip to content

Subnet Calculator

Calculate subnet with instant, accurate results and clear step-by-step output.

By CalcGenius Editorial TeamLast reviewed August 28, 20253 min read
Subnet Calculator

Common values: /8 (16M addresses), /16 (65K), /24 (256), /30 (4), /32 (1).

📊
Enter your values and click Calculate

About

An IPv4 address is a 32-bit number that identifies a device on an IP network. It is conventionally written as four decimal numbers separated by dots — for example, 192.168.1.100. Each of the four numbers is an octet (8 bits), so the full 32-bit address ranges from 0.0.0.0 to 255.255.255.255, giving about 4.3 billion possible addresses. The address is divided into two parts: a network prefix (identifying the subnet) and a host portion (identifying the device within the subnet). The boundary between them is set by the subnet mask.

A subnet is a logical subdivision of an IP network. The subnet mask is a 32-bit number with contiguous leading 1s for the network bits and contiguous trailing 0s for the host bits. For 192.168.1.0/24, the mask is 255.255.255.0 — the first 24 bits are 1s (network) and the last 8 bits are 0s (host). The CIDR notation /24 is a compact way to express the prefix length. CIDR replaced the older classful A/B/C system in 1993 (RFC 1519) because classful addressing wasted addresses — a Class B network had 65,536 addresses whether you needed them or not.

Of the 2^h addresses in a subnet (where h = 32 − CIDR is the number of host bits), two are reserved: the network address (all host bits 0, used to identify the subnet itself) and the broadcast address (all host bits 1, used to send a packet to every host in the subnet). The remaining 2^h − 2 addresses are usable for hosts. For a /24, that's 256 − 2 = 254 usable hosts. For a /30, that's 4 − 2 = 2 usable hosts — the standard for point-to-point links between routers. For a /32, there's only 1 address (no host bits), used for single-host routes like loopbacks.

Special rules apply at the boundary. RFC 3021 (2000) allows /31 subnets for point-to-point links: with only 2 addresses and no broadcast reserved, both addresses are usable, conserving IP space on router-to-router links. /32 is used for loopback interfaces and host-specific firewall rules. The 0.0.0.0/0 network represents the default route — "send to anywhere not otherwise specified." RFC 1918 defines three private address ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) that are not routed on the public internet and are used for home and enterprise internal networks.

Subnetting is the practice of dividing a larger network into smaller subnets. To subnet 192.168.1.0/24 into four /26 subnets, you borrow 2 more bits from the host portion: 24 + 2 = 26 network bits, leaving 6 host bits = 64 addresses per subnet, with 62 usable. The four subnets are 192.168.1.0/26 (hosts 1–62, broadcast 63), 192.168.1.64/26 (hosts 65–126, broadcast 127), 192.168.1.128/26 (hosts 129–190, broadcast 191), and 192.168.1.192/26 (hosts 193–254, broadcast 255). This is how network engineers allocate VLANs, departments, and routed segments within a single /24 or larger block.

How to Use

  1. 1
    Enter the IP address
    Type any IP address in dotted-decimal notation, e.g., 192.168.1.0. The calculator parses it as a 32-bit unsigned integer.
  2. 2
    Choose input mode: CIDR or subnet mask
    Either enter the CIDR prefix length (0–32) or the dotted-decimal subnet mask (e.g., 255.255.255.0). The calculator converts between them automatically.
  3. 3
    Read the network and broadcast addresses
    The hero result shows the network address (IP & mask). The breakdown shows broadcast address (IP | ~mask), subnet mask, wildcard mask, total IPs, usable hosts, and IP range.
  4. 4
    Verify against the private ranges
    If the network is in 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16, it's a private RFC 1918 range. If it's in 169.254.0.0/16, it's link-local. Public ranges are routed on the internet.
  5. 5
    Use the results for subnet design
    For VLANs, ACLs, firewall rules, DHCP scopes, and routing, use the network address, broadcast address, and usable host range. The wildcard mask is used in Cisco ACLs and OSPF statements.

Formula

Subnet mask from CIDR:

mask = 0xFFFFFFFF << (32 − CIDR), zero-padded to 32 bits

Network and broadcast addresses:

network = IP & mask (bitwise AND)
broadcast = IP | ~mask (bitwise OR with inverted mask)
wildcard = ~mask (bitwise NOT)

Host counts:

host bits h = 32 − CIDR
total IPs = 2^h
usable hosts = 2^h − 2 (CIDR 1–30)
usable hosts = 2 (CIDR 31, per RFC 3021)
usable hosts = 0 (CIDR 32, single host)

IP range:

first host = network + 1
last host = broadcast − 1

Example: 192.168.1.100/24.

  • mask = 255.255.255.0 (0xFFFFFF00)
  • network = 192.168.1.100 & 255.255.255.0 = 192.168.1.0
  • broadcast = 192.168.1.0 | 0.0.0.255 = 192.168.1.255
  • wildcard = 0.0.0.255
  • h = 8, total = 256, usable = 254
  • first host = 192.168.1.1, last host = 192.168.1.254

Worked Example

Example 1 — 10.0.5.42/8 (a Class A / RFC 1918 private range):

  • mask = 255.0.0.0
  • network = 10.0.0.0
  • broadcast = 10.255.255.255
  • h = 24, total = 16,777,216, usable = 16,777,214
  • first host = 10.0.0.1, last host = 10.255.255.254

Example 2 — 172.16.50.10/12 (RFC 1918 private, 1M addresses):

  • mask = 255.240.0.0
  • network = 172.16.0.0
  • broadcast = 172.31.255.255
  • h = 20, total = 1,048,576, usable = 1,048,574

Example 3 — 192.168.1.1/30 (point-to-point router link):

  • mask = 255.255.255.252
  • network = 192.168.1.0
  • broadcast = 192.168.1.3
  • h = 2, total = 4, usable = 2
  • first host = 192.168.1.1, last host = 192.168.1.2

Tips

  • Memorize the binary-to-decimal equivalents for the 4 subnet mask octet values: 0, 128, 192, 224, 240, 248, 252, 254, 255. These are the only valid mask octet values (contiguous 1s).
  • For quick mental math: subtract the host octet from 256 to get the subnet size. Mask 255.255.255.192 → 256 − 192 = 64 addresses per subnet, 62 usable hosts.
  • Use /30 for point-to-point router links (2 usable hosts, the minimum). Use /31 per RFC 3021 for even tighter point-to-point (2 addresses, no broadcast).
  • Use /32 for single-host routes — loopback interfaces, host-specific firewall rules, and loopback addresses (127.0.0.1/8 is reserved).
  • When subnetting a /24, the subnet boundaries fall on multiples of the subnet size: /26 has subnets at .0, .64, .128, .192; /28 has 16 subnets at .0, .16, .32, ... .240. Off-boundary addresses (e.g., .10/26) are interpreted as part of the .0/26 subnet.

Common Mistakes

Common mistakes
  • Forgetting that network (first IP) and broadcast (last IP) are reserved — usable hosts = 2^h − 2, not 2^h.
  • Using a non-contiguous mask (e.g., 255.255.255.123) — modern networks require contiguous 1s followed by 0s.
  • Using /31 or /32 for hosts — /31 is point-to-point only (RFC 3021), /32 is a single host route.
  • Confusing the subnet mask with the wildcard mask — they are bitwise inverses (255.255.255.0 ↔ 0.0.0.255).
  • Off-boundary subnet addresses — 192.168.1.10/26 belongs to 192.168.1.0/26, not a separate subnet starting at .10.

Frequently Asked Questions

What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation is the standard way to express a subnet by appending the network prefix length to the IP address, separated by a slash. For example, 192.168.1.0/24 means the first 24 bits are the network portion and the remaining 8 bits are the host portion. CIDR replaced the older classful A/B/C system in 1993 (RFC 1519) and is the basis of all modern IP routing.
How do you compute the number of usable hosts in a subnet?
Total addresses = 2^(32 − CIDR). Usable hosts = total − 2, because the first address (network) and the last address (broadcast) are reserved. For a /24, total = 2^8 = 256, usable = 254. For a /30, total = 2^2 = 4, usable = 2 — the standard for point-to-point links. For a /31, total = 2, usable = 0 by the original rule but 2 by RFC 3021 (point-to-point with no broadcast). For a /32, total = 1, usable = 0 — a single-host route.
What is the difference between network address and broadcast address?
The network address is the first IP in a subnet — all host bits are 0. It identifies the subnet itself, not any individual host. The broadcast address is the last IP — all host bits are 1. A packet sent to the broadcast address is delivered to every host in the subnet. For 192.168.1.0/24, the network address is 192.168.1.0 and the broadcast is 192.168.1.255. Usable hosts are 192.168.1.1 through 192.168.1.254 — 254 total.
What is the wildcard mask used for?
The wildcard mask is the bitwise NOT of the subnet mask — used in access control lists (ACLs) on Cisco routers and in OSPF network statements. For a /24 subnet (mask 255.255.255.0), the wildcard is 0.0.0.255. For a /26 (mask 255.255.255.192), the wildcard is 0.0.0.63. Cisco ACLs use wildcard masks because the matching semantics are inverted: 0 bits in the wildcard mean "must match" and 1 bits mean "don't care."
What are private IP address ranges?
RFC 1918 defines three private address ranges that are not routed on the public internet: 10.0.0.0/8 (16 million addresses), 172.16.0.0/12 (1 million addresses), and 192.168.0.0/16 (65,536 addresses). Home routers use 192.168.0.0/24 or 192.168.1.0/24 by default; medium networks use 10.0.0.0/8; enterprise networks use a mix. Carrier-grade NAT uses 100.64.0.0/10 (RFC 6598). Link-local addresses use 169.254.0.0/16.
How do I subnet a /24 into smaller /26 subnets?
Each /24 has 256 addresses. To make /26 subnets (64 addresses each), divide by 64: 256 / 64 = 4 subnets. The subnets are .0/26 (hosts 1–62, broadcast 63), .64/26 (hosts 65–126, broadcast 127), .128/26 (hosts 129–190, broadcast 191), and .192/26 (hosts 193–254, broadcast 255). Each /26 has 62 usable hosts. The mask is 255.255.255.192.

Subnet basics

A subnet is a logical subdivision of an IP network. Every IPv4 address is 32 bits, divided into a network portion (identifying the subnet) and a host portion (identifying an individual device within the subnet). The boundary between them is the subnet mask — a 32-bit number with leading 1s for the network bits and trailing 0s for the host bits. For 192.168.1.0/24, the first 24 bits are the network (192.168.1.) and the last 8 bits are the host (.0 through .255).

CIDR notation

CIDR (Classless Inter-Domain Routing) notation expresses a subnet as the IP address followed by a slash and the prefix length. /24 means 24 leading 1 bits in the mask; /16 means 16; /8 means 8. CIDR replaced the older classful A/B/C system in 1993 because the class system wasted addresses — a Class B network (172.16.0.0) had 65,536 addresses whether the organization needed them or not. CIDR allows subnet sizes in powers of 2 from /0 (the whole internet) to /32 (a single host).

Network vs host bits

The subnet mask divides the 32-bit IP address into a network portion and a host portion. The number of host bits is h = 32 − CIDR. The total number of addresses in the subnet is 2^h. For a /24, h = 8, so 2^8 = 256 addresses. For a /16, h = 16, so 2^16 = 65,536 addresses. For a /30, h = 2, so 2^2 = 4 addresses (used for point-to-point links). For a /32, h = 0, so 2^0 = 1 address (a single host route).

Why 2^h − 2 usable hosts

Of the 2^h addresses in a subnet, two are reserved: the network address (all host bits 0) and the broadcast address (all host bits 1). The remaining 2^h − 2 are usable for hosts. For a /24, that's 256 − 2 = 254 usable hosts. For a /30, that's 4 − 2 = 2 usable hosts (the standard for point-to-point links). For /31 and /32, see RFC 3021 for the special rules — /31 is used for point-to-point with no broadcast, and /32 is a single-host route.

Common CIDR block sizes from /8 (whole Class A) to /32 (single host).
CIDRSubnet maskTotal IPsUsable hostsNotes
/8255.0.0.016,777,21616,777,214Class A / RFC 1918 10.0.0.0/8
/16255.255.0.065,53665,534Class B / RFC 1918 172.16.0.0/12 (large)
/24255.255.255.0256254Class C / RFC 1918 192.168.0.0/16 (default home)
/25255.255.255.128128126Two subnets per /24
/26255.255.255.1926462Four subnets per /24
/27255.255.255.2243230Eight subnets per /24
/30255.255.255.25242Point-to-point links (router to router)
/32255.255.255.25510Single-host route (loopback, specific host)
From classful to CIDR

Before 1993, IPv4 networks were classful: Class A (/8, 16M addresses), Class B (/16, 65K addresses), Class C (/24, 256 addresses). The class was inferred from the first bits of the address (0 = A, 10 = B, 110 = C). This system wasted enormous numbers of addresses — a Class B allocation gave 65,536 addresses even if the organization needed only 1,000. CIDR (RFC 1519, 1993) replaced classful with arbitrary prefix lengths, allowing subnet sizes in any power of 2 from /0 to /32. This saved the IPv4 internet from premature exhaustion in the 1990s; the same principle underpins IPv6.

Subnet design rules of thumb

For home networks, /24 (256 addresses, 254 usable) is plenty — most home routers default to 192.168.1.0/24 or 192.168.0.0/24. For small offices, /23 (512 addresses) or /22 (1,024) gives growth headroom. For point-to-point router links, /30 (4 addresses) or /31 (2 addresses, RFC 3021). For loopback interfaces, /32 (single host). For internal enterprise networks, /16 or /20 with VLANs segmented by department. Plan for 30–50% headroom — subnet resizing later requires readdressing.

Authoritative References

  • Wikipedia — Subnetwork— Wikipedia
    Overview of IPv4 subnetting, CIDR notation, network and broadcast addresses, and the history from classful to classless routing.
  • RFC 950 — Internet Standard Subnetting Procedure— ietf.org
    The original 1985 RFC that defined subnetting, including the use of subnet masks to divide a network into smaller subnets. Superseded in part by RFC 1518/1519 (CIDR).
  • IANA — Private IPv4 address space— iana.org
    IANA's special registry of reserved IPv4 address blocks, including the RFC 1918 private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) and link-local (169.254.0.0/16).

Try our other free calculators

CalcGenius has 1,200+ free, ad-free, browser-based calculators for finance, health, math, science, and everyday life. No sign-up required.

Subnet Calculator — Circuit, Beam & Fluid Design Check