KKwikfig.

IP Subnet Calculator

Work out any IPv4 subnet from an address and a prefix or netmask — network, broadcast, wildcard, usable host range and counts, with the /31 and /32 rules handled. Runs entirely in your browser — your numbers never leave this device.

Give the size as
CIDR notation
192.168.1.0/24
Network address
192.168.1.0
Broadcast address
192.168.1.255
Netmask
255.255.255.0
Wildcard mask
0.0.0.255
First usable host
192.168.1.1
Last usable host
192.168.1.254
Total addresses
256
Usable hosts
254

Conventions: for /30 and larger blocks, the network and broadcast addresses are reserved, so usable hosts = total − 2. A /31 point-to-point link (RFC 3021) uses both addresses, and a /32 is a single host route with exactly one usable address.

How it works

Netmask = 32 bits: the first 'prefix' bits are 1, the rest 0 | Network = address AND netmask | Broadcast = network OR (NOT netmask) | Total addresses = 2^(32 − prefix) | Usable = total − 2 for prefix ≤ 30; = 2 for /31 (RFC 3021); = 1 for /32
Common subnet sizes at a glance
PrefixNetmaskTotal addressesUsable hosts
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/24255.255.255.0256254
/26255.255.255.1926462
/30255.255.255.25242
/31255.255.255.25422 (point-to-point, RFC 3021)
/32255.255.255.25511 (single host route)

A subnet is a run of addresses carved out by a mask, and everything about it is bitwise arithmetic. Line the address up against the netmask: where the mask has 1s, the network part is copied; where it has 0s, the host part can vary. Set all host bits to 0 and you have the network address; set them all to 1 and you have the broadcast; invert the mask and you have the wildcard mask Cisco ACLs speak. This calculator does that uint32 arithmetic for any IPv4 address with any prefix — or takes a dotted netmask instead and works out the prefix, refusing non-contiguous masks like 255.0.255.0 that cannot exist.

Host counts follow the address-reservation conventions, and the edge cases are where calculators disagree, so they are stated plainly: for /30 and larger blocks the network and broadcast addresses are reserved and usable hosts are total − 2. A /31 has no room for that reservation — RFC 3021 defines it as a point-to-point link where both addresses are usable. A /32 is a single host route: network, broadcast, first and last usable are all that one address, and the usable count is 1. The /31 worked example below pins the convention so you can check it against your own network documentation.

The results use the address you typed only to locate its block — 192.168.1.10/24 and 192.168.1.200/24 describe the same subnet, and the calculator says so by reporting the same network, range and counts for both. All arithmetic is exact integer math done in your browser; nothing about your addressing is sent anywhere, which matters when the addresses are an internal network plan.

Worked examples

A home-network /24

Input
Address = 192.168.1.10, Prefix = /24
Working
The /24 mask 255.255.255.0 keeps the first three octets as the network part: AND gives network 192.168.1.0, OR with the wildcard 0.0.0.255 gives broadcast 192.168.1.255. The block holds 2^8 = 256 addresses; reserving those two leaves 254 usable, from .1 to .254.
Result
Network 192.168.1.0 · Broadcast 192.168.1.255 · Usable 192.168.1.1 – 192.168.1.254 (254 hosts)

Starting from a dotted netmask

Input
Address = 192.168.1.77, Netmask = 255.255.255.192
Working
255.255.255.192 has 26 one-bits, so this is a /26: 64 addresses per block, and 77 falls in the block starting at 64. Network 192.168.1.64, broadcast 192.168.1.127, usable .65–.126 — 62 hosts.
Result
Prefix /26 · Network 192.168.1.64 · Broadcast 192.168.1.127 · Usable 62 hosts (.65 – .126)

The /31 point-to-point exception

Input
Address = 172.16.0.1, Prefix = /31
Working
The block is 172.16.0.0–172.16.0.1, two addresses. Under the total − 2 rule it would have zero usable hosts, which is why RFC 3021 defines /31 links to use both addresses — the standard trick for conserv­ing IPv4 space on router-to-router links.
Result
Network 172.16.0.0 · Broadcast 172.16.0.1 · First usable 172.16.0.0 · Last usable 172.16.0.1 · Usable hosts 2

Frequently asked questions

Why does a /31 have 2 usable hosts instead of 0?

Because the total − 2 rule assumes a broadcast domain with a network address and a broadcast address to reserve. A point-to-point link has exactly two endpoints and no broadcast traffic in the classic sense, so RFC 3021 redefined /31 links to use both addresses. This calculator follows that convention (and says so next to the result); older tooling that reports 0 for a /31 is applying the LAN rule to a link type it was not written for.

What is a wildcard mask for?

It is the bitwise inverse of the netmask — 0.0.0.255 where the mask is 255.255.255.0 — where 1 bits mean 'this bit may vary'. Cisco IOS access lists and some routing protocols (OSPF network statements) are written in wildcard form, so the calculator prints it alongside the netmask rather than making you invert it by hand.

Why is 255.0.255.0 rejected as a netmask?

A netmask must be one unbroken run of 1s followed by one unbroken run of 0s — that is what makes 'the first N bits are the network part' well-defined. 255.0.255.0 interleaves them, so no prefix length describes it and no subnet corresponds to it. The calculator returns an error naming the problem instead of silently inventing a block.

Does the host address I type change the result?

Only by locating the block. Every address inside 192.168.1.0/24 — .10, .200, .254 — yields the same network, broadcast, range and counts, because those are properties of the block, not of the representative you typed. If two results differ, the prefixes differ.

How many subnets do I get if I split a /24 into /26s?

Four: each step of prefix length doubles the count and halves the size. A /24 (256 addresses) splits into four /26s of 64 (62 usable each), or eight /27s, or sixty-four /30s. Run each candidate prefix through this calculator with any address in the parent block to see its exact boundaries.

Is IPv6 supported?

No — this calculator is deliberately IPv4-only, where masks, broadcast addresses and the usable-host conventions above apply. IPv6 subnetting is a different exercise (no broadcast, /64 as the standard LAN size, hexadecimal prefix math) and squeezing it into the same result table would make both halves less clear.

Related tools

More in Developer Tools · Browse all tools