Subnet Calculator

Enter an IPv4 address with a CIDR prefix to get the network address, broadcast address, subnet mask and usable host range. Runs in your browser.

Loading tool…

Worked examples

  • A standard /24 home or office network

    The everyday case: any host address in a /24 resolves to the same network and broadcast address, with 254 usable addresses in between.

  • A small /30 point-to-point subnet

    A /30 is the classic router-to-router link size — 4 total addresses, but only 2 usable once the network and broadcast addresses are reserved.

  • A /31 point-to-point link with no broadcast address

    RFC 3021 /31 subnets are a special case used for point-to-point links — both addresses are usable hosts since there's no room to reserve a network or broadcast address.

What this tool does

This tool takes an IPv4 address written with a CIDR prefix, like 192.168.1.10/24, and calculates everything that prefix implies: the network address, the broadcast address, the subnet mask and its wildcard equivalent, the range of usable host addresses, and the total number of addresses in the block. You don't need to pre-zero the host bits in the address you enter — the network address is calculated from whatever address and prefix you provide.

When you need it

  • Planning how to divide a network into subnets, and checking exactly how many usable hosts a given prefix length actually provides before committing to it.
  • Configuring a router, firewall or DHCP server, where you need the precise network and broadcast addresses for a subnet, not just an approximate range.
  • Debugging why a device can't reach another host on the "same" network, by confirming whether both addresses actually fall within the same subnet.
  • Studying for a networking certification or teaching subnetting, where seeing the network address, broadcast address and host range computed together for different prefix lengths builds the intuition tables alone don't.

How the calculation works

A CIDR prefix like /24 specifies how many of the address's 32 bits are the network portion; the rest are host bits. The subnet mask is built by setting exactly that many leading bits to 1. The network address is the entered address with every host bit forced to 0, and the broadcast address is the same address with every host bit forced to 1 — those two addresses mark the start and end of the block. Everything strictly between them is a usable host address. The wildcard mask, used in access control lists and some routing configurations instead of a subnet mask, is simply the subnet mask's bitwise inverse.

Two special cases: /31 and /32

A /32 describes a single address with no separate network or broadcast — it's used to identify one specific host, most often a loopback or a route to a single destination, and this tool reports that one address as both the first and last (and only) usable host, with 1 total address. A /31, per RFC 3021, is a deliberate exception for point-to-point links: with only 2 addresses total, there's no room to reserve a separate network and broadcast address the way larger blocks do, so both addresses are treated as usable hosts — a router-to-router WAN link is the classic real-world use. For a /31 the "Broadcast address" field simply shows the second (last) address of the pair, since no address is actually reserved for broadcast.

Reading the usable host count

For any prefix from /0 through /30, the usable host count is the total address count minus 2, reserving one address for the network identifier and one for the broadcast address — the traditional IPv4 subnetting rule. A /24 has 256 total addresses and 254 usable hosts; a /30, often used for a small point-to-point or management link, has 4 total addresses and exactly 2 usable.

Limits

This tool works with IPv4 only — IPv6 uses a fundamentally different addressing scheme (no broadcast address, for one) and isn't covered here. Input must be a standard dotted-decimal address with each octet from 0–255, followed by a prefix from 0–32. Octets with a leading zero (010.0.0.1) are rejected, because some systems read them as octal and others as decimal; leading and trailing spaces are ignored. A /0 block reports 4,294,967,296 total addresses and 4,294,967,294 usable hosts, which is the arithmetic result rather than a practical network size.

Frequently asked questions

Is my IP address sent anywhere?
No. The calculation is pure arithmetic that runs entirely in your browser; nothing is sent to a server.
What format should I enter?
An IPv4 address followed by a slash and a prefix length, such as 192.168.1.10/24. The host bits in the address you enter don't need to already be zeroed out — the network address is calculated for you.
Why does a /31 have 2 usable hosts instead of 0?
RFC 3021 makes an exception for /31 subnets, used almost exclusively for point-to-point links: with only 2 addresses total there's no room to reserve a separate network and broadcast address, so both are treated as usable.
What's the difference between the subnet mask and the wildcard mask?
The subnet mask marks network bits with 1s and host bits with 0s (used in most configs); the wildcard mask is its bitwise inverse (used in access control lists and some routing configs) — this tool shows both.