IP · CIDR · Subnets

IPv4 subnet calculator

Enter any address and prefix — network range, broadcast, usable hosts, masks, and a bit-level view all update live. Paste CIDR notation like 10.0.0.0/8 to fill both fields at once.

Usable hosts

254

Network

192.168.1.0

Broadcast

192.168.1.255

Subnet mask

255.255.255.0

Wildcard mask

0.0.0.255

Address & prefix

/

Subnet details

Network address192.168.1.0
Broadcast192.168.1.255
First usable192.168.1.1
Last usable192.168.1.254
Usable hosts254
Total IPs256
Subnet mask255.255.255.0
Wildcard mask0.0.0.255
CIDR notation192.168.1.0/24
IP classClass C
Range typePrivate

Bit-level view — network   host

Putting VLANs to work? You need a managed switch that supports 802.1Q tagging. TP-Link makes solid budget-friendly options — web-managed with full 802.1Q support. See managed switches →

What a subnet mask actually does

Every IPv4 address is 32 bits. A subnet mask (or its shorthand, the CIDR prefix — the /24 in 192.168.1.0/24) splits those 32 bits into a network portion and a host portion. The network portion has to match for two devices to talk directly, without a router in between; the host portion is what's actually available to assign to individual devices. A /24 reserves the first 24 bits for the network, leaving 8 bits — 256 possible values — for hosts. Subtract the network address and broadcast address (neither is assignable to a device) and you get 254 usable hosts, which is exactly what this calculator shows for a default /24.

Reading the bit-level view

The binary breakdown at the bottom of the calculator is the actual mechanism, not just a visualization. Every bit set to 1 in the mask is network; every bit set to 0 is host. Bitwise AND the IP address against the mask and you get the network address — the first address in the range, never assignable. Flip every host bit to 1 and you get the broadcast address — the last address, also never assignable. Everything between those two is usable. This is worth understanding once, by eye, because it's the same operation your router, firewall rules, and DHCP scope are all doing under the hood every time they decide whether two addresses are "on the same network."

Common prefix lengths, at a glance

PrefixSubnet maskTotal addressesUsable hostsTypical use
/30255.255.255.25242Point-to-point link (router-to-router)
/29255.255.255.24886Tiny segment, small device cluster
/28255.255.255.2401614Small VLAN — a handful of servers
/27255.255.255.2243230Department-sized segment
/26255.255.255.1926462Larger office segment
/25255.255.255.128128126Half a /24, common VLAN split
/24255.255.255.0256254Standard LAN/VLAN default
/23255.255.254.0512510Two combined /24s, larger sites
/16255.255.0.065,53665,534Whole private range (10.x.x.x lab)

The pattern: each step down in prefix length (say /25 to /24) doubles the address space. Every step up does the opposite — halves it. Getting comfortable with that doubling relationship is most of what "understanding subnetting" actually means in practice.

Special cases this calculator handles

Worked example

You're given 10.20.6.130/26 and need to know what network it belongs to. A /26 mask is 255.255.255.192, meaning the last octet splits into blocks of 64 (256÷4, since a /26 leaves 2 host bits worth of subnetting — four /26 blocks per /24). 130 falls in the third block: 0–63, 64–127, 128–191, 192–255. So the network address is 10.20.6.128, broadcast is 10.20.6.191, and usable hosts run from 10.20.6.129 to 10.20.6.190 — 62 addresses. Paste 10.20.6.130/26 into the calculator above to confirm.

What's the difference between a subnet mask and a CIDR prefix?

Same information, two notations. 255.255.255.0 and /24 describe the identical split of network vs. host bits — CIDR notation just counts the network bits directly instead of writing them out as a dotted-decimal mask. Modern configs almost always use CIDR notation; the mask form still shows up on older hardware and some Windows network adapter settings.

Why are there only 254 usable hosts on a /24, not 256?

Two addresses in every subnet are reserved and can't be assigned to a device: the network address (all host bits zero — identifies the subnet itself) and the broadcast address (all host bits one — sends to every device on the subnet at once). A /24 has 256 total addresses; subtract those two and 254 remain usable. This −2 rule applies to every prefix length except /31 and /32, which have their own RFC-defined exceptions.

How do I know what subnet an IP address belongs to?

Bitwise AND the address against the subnet mask. In practice: find which block of addresses (sized by the mask) the address falls into. For a /26 (blocks of 64), an address ending in .130 falls in the 128–191 block, so the network address is .128. Paste the address and prefix into the calculator above for the exact breakdown, including the bit-level view.

What is RFC 1918 and why does it matter?

RFC 1918 defines the three IPv4 ranges set aside for private networks, never routable on the public internet: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. Nearly every home and office network uses addresses from one of these ranges internally, translated to a public address at the router via NAT. This calculator flags any address in these ranges automatically.

Can I use a /31 subnet? I thought subnets needed at least 2 usable hosts.

Yes, specifically for point-to-point links (router-to-router, for example) — RFC 3021 carves out an exception where both addresses in a /31 are usable, since a link with exactly two endpoints doesn't need a separate network or broadcast address. Most other use cases still need /30 or larger.

What's the largest and smallest subnet I can have?

Largest is /0 — the entire IPv4 address space, never used in practice. Smallest meaningful subnet is /31 (2 usable addresses, point-to-point only) or /32 (a single host route, not really a "subnet"). Real-world subnets almost always fall between /8 (huge, a whole legacy Class A) and /30 (4 addresses, 2 usable) depending on how many devices actually need to fit.

What does "Class C" mean in the results, and does it still matter?

Class A/B/C are the original 1980s scheme that assigned fixed prefix lengths by an address's first octet (Class C = /24, for example). CIDR replaced that rigid system decades ago — prefix lengths are now chosen independently of address class. This calculator shows the legacy class for reference since the terminology still shows up in older documentation and some exam material, but it has no effect on how modern networks are actually configured.

From the blog: Documentation Is the Cheapest Network Upgrade You’ll Ever Buy · The Subnetting Mental Model I Actually Use On Site

IPv4 only · /31 treated as point-to-point per RFC 3021 · /32 is a host route