Skip to main content

IPv4 Subnet Calculator

Every IPv4 network is a block of addresses carved by one line: the first so-many bits name the network, the rest name the host. This calculator draws that line for any address and prefix (or dotted netmask) and reads off everything that follows — network, broadcast, mask, wildcard, and the usable host range.

The bit math is printed under every result, including the two places the everyday rules change: /31 links and /32 host routes.

Subnet given as

Network address

192.168.1.0

Broadcast address

192.168.1.255

Netmask

255.255.255.0 (/24)

Wildcard mask

0.0.0.255

Total addresses

256

Usable hosts

254

First usable

192.168.1.1

Last usable

192.168.1.254

Range: Private range (RFC 1918, 192.168.0.0/16)

In binary

IP   11000000.10101000.00000001.00001010
Mask 11111111.11111111.11111111.00000000

How it is worked out

  1. The /24 prefix keeps the first 24 bits as the network part; the remaining 8 bits vary per host, giving 2^8 = 256 addresses per block.
  2. Network address: the address with every host bit set to 0 — 192.168.1.0. Broadcast: every host bit set to 1 — 192.168.1.255.
  3. Usable hosts exclude the network and broadcast addresses: 256 − 2 = 254, from 192.168.1.1 to 192.168.1.254.

Embed this calculator on your website →

The formula

addresses in the block = 2^(32 − prefix)

usable hosts = addresses − 2 (network and broadcast excluded)

  • network address — the block's first address: the given address with every host bit set to 0. Broadcast — every host bit set to 1.
  • the /31 exception — on point-to-point links (RFC 3021) there is no broadcast and both addresses are usable. /32 is a single host route: one address, usable.
  • wildcard mask — the netmask with every bit flipped; it is the form used in router access lists.

Worked example: 192.168.1.10/24 → network 192.168.1.0, broadcast 192.168.1.255, 256 addresses, 254 usable from .1 to .254 — the default in the tool above.

How it works

Blocks align to their size. A /23 holds 512 addresses, so its blocks start at even boundaries in the third octet: 192.168.1.77/23 belongs to the block starting 192.168.0.0, not 192.168.1.0. Entering an address inside a block and being shown the block it lives in — rather than the address itself — is the calculator's main job, and the one people most often get wrong by hand.

Private ranges are labelled. The result names the block the address sits in: the RFC 1918 private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) used inside homes and companies, loopback (127.0.0.0/8), link-local (169.254.0.0/16), or public. Note the trap the label protects against: 172.16–172.31 is private, but 172.32 is public — the private block is a /12, not a /8.

Leading zeros are refused. An octet written 010 was historically read as octal (eight) by some software — an address that means two things is an incident waiting to happen, so 192.168.01.1 is rejected with the reason rather than guessed at.

Examples

  • 10.0.5.77/8 → network 10.0.0.0, 16,777,214 usable hosts — the largest private block.
  • 192.168.1.5/30 → exactly 2 usable hosts (.5 and .6) — the classic small link subnet.
  • 192.168.1.9/31 → both addresses usable under RFC 3021 — no network/broadcast tax.
  • 1.2.3.4/0 → the entire IPv4 space: network 0.0.0.0, broadcast 255.255.255.255, 4,294,967,296 addresses.

Frequently asked questions

What does the /24 (prefix) actually mean?

That the first 24 of the address's 32 bits are fixed for the whole network, leaving 8 bits — 256 addresses — for hosts. A bigger prefix means a smaller block: /25 halves a /24, and each step up halves the block again. The prefix and the netmask are the same information (255.255.255.0 IS /24), which is why the tool accepts either.

Why are two addresses always missing from the usable count?

The first address names the network itself and the last is the broadcast address — every host hears it — so neither can be given to a device. The rule is waived exactly where it makes no sense: /31 point-to-point links (RFC 3021) and the single-address /32.

Is 172.20.5.4 a private address?

Yes. The private block is 172.16.0.0/12, covering 172.16.0.0 through 172.31.255.255. The common mistake is treating all of 172.x as private (it is not — 172.32.0.1 is a public address) or only 172.16.x as private. The calculator labels the range on every result so you do not have to remember the boundary.

Does this work for IPv6?

No — this calculator is IPv4 only, and says so rather than mangling an IPv6 input. IPv6 subnetting uses the same prefix idea at 128 bits, but its address notation, compression rules, and the absence of broadcast make it a different tool.