Calcist

Style

Buttons

Spacing

How much to show

Decimal places

Text size

Subnet calculator

Find the network, broadcast address, host range, usable hosts and wildcard mask for any IPv4 address and prefix.

Private: calculated on your device. Nothing you type is sent anywhere.

Next: Converting the address bits to hex or binary? Use the programmer calculator.

What this subnet calculator does

Enter an IPv4 address and a prefix length (CIDR) or subnet mask. You get the network address, the broadcast address, the first and last usable host, the number of usable hosts, the wildcard mask and the binary view. It also works as a broadcast address calculator. /31 and /32 are handled the way the standards say, not with the "minus 2" rule.

How it's calculated

An IPv4 address is a 32-bit number. A /n prefix means the first n bits name the network and the rest name hosts. The subnet mask has n ones followed by 32 − n zeros. In CIDR notation (RFC 4632), 192.168.1.0/24 means the first 24 bits are the network.

network = IP AND mask  ·  broadcast = network OR (NOT mask)  ·  wildcard = NOT mask
addresses = 2^(32 − n)  ·  usable hosts = 2^(32 − n) − 2 (for /0 to /30)

The all-zeros host address names the network itself. The all-ones host address is the directed broadcast (RFC 919), so both are taken out of the usable count.

/31 and /32

  • /31: RFC 3021 lets point-to-point links use a 31-bit prefix. Both addresses are host addresses, and there's no directed broadcast address. So a /31 has 2 usable hosts, not 0.
  • /32: one address, a single host (often called a host route). There is no separate network or broadcast address.

Worked example

10.0.0.77 with mask 255.255.255.192. 192 is 11000000 in binary, so the mask is /26 and the last 6 bits are for hosts. 77 is 01001101. Keeping the top 2 bits of the last byte gives 01000000 = 64, so the network is 10.0.0.64. Setting the 6 host bits to 1 gives 01111111 = 127, so the broadcast is 10.0.0.127. The usable hosts run from 10.0.0.65 to 10.0.0.126: 2⁶ − 2 = 62 of them. The wildcard mask is 0.0.0.63.

Subnet reference table

PrefixSubnet maskAddressesUsable hosts
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/22255.255.252.01,0241,022
/23255.255.254.0512510
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/31255.255.255.25422
/32255.255.255.25511

Limitations

  • IPv4 only. IPv6 uses 128-bit addresses and has no broadcast address.
  • Some equipment reserves extra addresses (a gateway, or addresses a cloud provider keeps). Check your platform's rules.
  • Private ranges (RFC 1918) are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. The result tells you if your address is in one.

Sources

How we checked this

Before every update, this calculator is run in a real browser with these known answers, and it must match all of them:

  • 192.168.1.10/24: broadcast 192.168.1.255, 254 hosts ✓
  • 10.0.0.77 with 255.255.255.192: network 10.0.0.64, 62 hosts ✓
  • 10.0.0.77/26: wildcard mask 0.0.0.63 ✓
  • Edge: /31 has 2 usable hosts (RFC 3021) ✓
  • Edge: /32 is a single host ✓
  • /0 holds 4,294,967,294 usable hosts ✓
  • Edge: 300.1.1.1 isn't a valid address ✓
  • Edge: 255.0.255.0 isn't a valid mask ✓

Last checked October 26, 2026. Spotted something wrong? The math is done in your browser with the formula shown on this page, so you can check any result by hand.

Add this calculator to your website (free)

Paste this code into any web page. The calculator works on your page, resizes itself, has no ads and no tracking, and nothing your visitors type is sent anywhere. More about embedding.

Questions people ask

How do I find the broadcast address of a subnet?

Set all the host bits to 1: broadcast = network address OR the wildcard mask. For 192.168.1.10/24 that's 192.168.1.255.

How many usable hosts are in a /24?

254. A /24 has 2⁸ = 256 addresses, minus the network and broadcast addresses.

What is a wildcard mask?

The subnet mask with every bit flipped. For 255.255.255.0 it's 0.0.0.255. Access lists and some routing protocols, such as OSPF on Cisco devices, use it.

Can you use a /31 subnet?

Yes, on point-to-point links. RFC 3021 treats both addresses as hosts, so a /31 gives 2 usable addresses with no broadcast address.

Related calculators