Skip to content
K Knidox Search…
Computer Science · Networking

IP Subnet Calculator

Get the network, broadcast, mask, wildcard, and host range from any IPv4 address and CIDR prefix.

Four octets, 0–255 each, e.g. 192.168.1.10.
/24
Network bits, /0–/32.
Common networks — tap to try
192.168.1.10/24 · 8 host bits
Network address192.168.1.0
Broadcast address192.168.1.255
Subnet mask255.255.255.0
Wildcard mask0.0.0.255
First usable host192.168.1.1
Last usable host192.168.1.254
Usable hosts254
Total addresses256

The network and broadcast addresses are reserved, so usable hosts = total − 2.

For 192.168.1.10/24 the network address is 192.168.1.0 and the broadcast is 192.168.1.255, with a subnet mask of 255.255.255.0 and wildcard 0.0.0.255. That leaves 254 usable hosts (192.168.1.1 to 192.168.1.254) out of 256 total addresses — the network and broadcast addresses are reserved.

What a subnet calculator works out

An IPv4 address is a 32-bit number, and a CIDR prefix like /24 says how many of those bits identify the network. Everything to the left of the prefix is the network portion; everything to the right is the host portion. From just an address and a prefix you can derive the whole block: the network address (all host bits set to 0), the broadcast address (all host bits set to 1), the subnet mask and its inverse the wildcard mask, and the range of addresses that can be assigned to real devices.

host bits = 32 − prefix, usable hosts = 2host bits − 2

Total addresses = 2^(32 − prefix). The −2 removes the network and broadcast addresses (see /31 and /32 exceptions below).

Worked example: 192.168.1.10/24

A /24 keeps the first 24 bits as the network and leaves the last 8 bits (one octet) for hosts, so there are 2⁸ = 256 addresses in the block.

  1. 1
    Build the mask from the prefix. A /24 sets the top 24 bits to 1: 11111111.11111111.11111111.00000000 = 255.255.255.0. The wildcard is the inverse, 0.0.0.255.
  2. 2
    Find the network address (IP AND mask). 192.168.1.10 AND 255.255.255.0 zeroes the host bits, giving 192.168.1.0.
  3. 3
    Find the broadcast address (network OR wildcard). 192.168.1.0 OR 0.0.0.255 sets every host bit, giving 192.168.1.255.
  4. 4
    Count the hosts. Host bits = 32 − 24 = 8, so total = 2⁸ = 256 and usable = 256 − 2 = 254.
  5. 5
    Read off the usable range. First host = network + 1 = 192.168.1.1; last host = broadcast − 1 = 192.168.1.254.

Common CIDR prefixes

Total addresses, usable hosts, and subnet mask for frequently used IPv4 prefixes.

PrefixTotal addressesUsable hostsSubnet mask
/24256254255.255.255.0
/25128126255.255.255.128
/266462255.255.255.192
/273230255.255.255.224
/281614255.255.255.240
/3042255.255.255.252
/3211255.255.255.255

Network vs broadcast, and why you subtract 2

Inside every ordinary subnet, two addresses are reserved and cannot be assigned to a device. The network address — all host bits 0 — names the subnet itself and is what appears in routing tables. The broadcast address — all host bits 1 — reaches every host on the subnet at once. Because both are taken, the usable host count is total − 2. Two prefixes break this rule: a /31 has only two addresses and, under RFC 3021, both are usable for point-to-point links, so there is no separate broadcast. A /32 describes a single host — one address with no network or broadcast to reserve — commonly used for loopbacks and host routes.

Why do you subtract 2 from the host count?
Every normal subnet reserves two addresses: the network address (all host bits 0) that names the subnet, and the broadcast address (all host bits 1) that reaches every host at once. Neither can be assigned to a device, so usable hosts = total addresses − 2.
What is the broadcast address?
The broadcast address is the last address in the subnet — every host bit set to 1. A packet sent to it is delivered to all hosts on that subnet. For 192.168.1.0/24 the broadcast is 192.168.1.255.
What is the difference between a subnet mask and a wildcard mask?
The subnet mask has 1s for network bits and 0s for host bits (255.255.255.0 for a /24). The wildcard mask is its exact inverse (0.0.0.255) — it marks the host bits and is used by tools like ACLs and OSPF.
How do /31 and /32 prefixes work?
A /31 has just two addresses; under RFC 3021 both are usable on point-to-point links, with no reserved broadcast. A /32 is a single host — one address with no network or broadcast reserved — often used for loopbacks and host routes.
How does a CIDR prefix relate to the subnet mask?
The prefix is simply the number of leading 1-bits in the mask. /24 means 24 ones followed by 8 zeros, which is 255.255.255.0; /26 means 26 ones, which is 255.255.255.192. Bigger prefixes mean smaller subnets.
How many usable hosts does a /26 have?
A /26 leaves 32 − 26 = 6 host bits, so it holds 2⁶ = 64 addresses. Subtracting the network and broadcast addresses leaves 62 usable hosts.