IPv4 Subnetting Guide

Subnetting is the practice of dividing a larger IP network into smaller, more efficient sub-networks. It lets you control broadcast domain size, conserve addresses, apply security policy at the network boundary, and summarize routes. This guide walks through the mechanics from first principles so you can subnet by hand and verify with the subnet calculator.

Built by a network engineerCalculations run locally in your browserNo signup requiredNetwork information is not transmitted to our servers

The 32-bit IPv4 address

An IPv4 address is 32 bits, written as four decimal octets separated by dots. Each octet represents 8 bits, so each ranges from 0 to 255. The address is split into two parts: the network prefix (shared by every host in the subnet) and the host portion (unique within the subnet). A subnet mask or CIDR prefix tells you where that split happens.

192.168.1.130 / 255.255.255.0  (or /24)

Binary:
11000000.10101000.00000001.10000010
^^^^^^^^ ^^^^^^^^ ^^^^^^^^          ← network prefix (24 bits)
                          ^^^^^^^^  ← host portion (8 bits)

Reading a subnet mask

A subnet mask is a 32-bit value where contiguous 1-bits mark the network portion and contiguous 0-bits mark the host portion. Masks must be contiguous — 255.255.255.0 is valid, 255.0.255.0 is not. The CIDR prefix is simply the count of 1-bits, written as /24.

CIDRSubnet maskBinary
/24255.255.255.011111111.11111111.11111111.00000000
/25255.255.255.12811111111.11111111.11111111.10000000
/26255.255.255.19211111111.11111111.11111111.11000000
/30255.255.255.25211111111.11111111.11111111.11111100

The four addresses you must find

For any subnet, four values matter:

  1. Network address — host bits all 0. The subnet itself.
  2. First usable host — network address + 1.
  3. Broadcast address — host bits all 1. Last address in the subnet.
  4. Last usable host — broadcast address − 1.

Worked example: 192.168.1.130/26

A /26 leaves 6 host bits (32 − 26 = 6), so each subnet has 2⁶ = 64 addresses. The block size is 64. Find which block 192.168.1.130 falls in: 130 ÷ 64 = 2 with remainder 2, so the network address is 192.168.1.128.

Network:   192.168.1.128   (host bits 000000)
First host: 192.168.1.129
Last host:  192.168.1.190
Broadcast:  192.168.1.191   (host bits 111111)
Usable hosts: 64 - 2 = 62

The core formulas

QuantityFormula
Host bitsh = 32 − prefix
Total addresses2^h
Usable hosts2^h − 2 (except /31 and /32)
Subnet count (from a larger block)2^(new_prefix − old_prefix)
Block size (last octet)256 − last_octet_of_mask

Subnetting a /24 into smaller pieces

A common task: take 192.168.1.0/24 and carve it into /26s. Each /26 borrows 2 bits from the host portion (26 − 24 = 2), producing 2² = 4 subnets of 64 addresses each.

SubnetNetworkUsable rangeBroadcast
1192.168.1.0.1 – .62.63
2192.168.1.64.65 – .126.127
3192.168.1.128.129 – .190.191
4192.168.1.192.193 – .254.255

Configuration snippets

Cisco IOS interface

interface GigabitEthernet0/0
 description User VLAN
 ip address 192.168.1.130 255.255.255.192
 no shutdown

Linux (iproute2)

ip addr add 192.168.1.130/26 dev eth0
ip link set eth0 up

Common pitfalls

  • Forgetting the broadcast — the all-ones host address is reserved, not assignable.
  • Miscounting on non-octet boundaries — a /23 spans 512 addresses across two octets; the block size is 512, not 256.
  • Overlapping subnets — when carving, always start the next block at the previous broadcast + 1.
  • Using .0 or .255 blindly — these are only network/broadcast on a /24. On a /26, .128 and .191 are the reserved ones.

Verify your work

Manual subnetting is error-prone under time pressure. Use the subnet calculator to check your math, the CIDR calculator for prefix conversions, and the DHCP scope calculator when laying out pools. For multi-subnet planning, use the VLSM calculator, and verify your design with the subnet overlap checker. For a quick reference of every prefix, see the subnetting cheat sheet or the CIDR cheat sheet.

Related guides

Technically Reviewed By

Senior Enterprise Network Engineer — 25+ years of IT and network infrastructure experience, including enterprise Cisco switching, routing, wireless, firewalls, VPN, network access control, SD-WAN, and large-scale network operations.

Last reviewed: 2026-09-02

Calculations are performed using standards-based formulas and verified against known reference values. All computation runs client-side in your browser.