IP Subnet

Compare Calculations

Downloads

Includes your inputs and results for this calculation, plus any additional calculations you've compared.

Splitting an IPv4 Address into Network and Host Portions

A subnet mask splits an IPv4 address into a network portion and a host portion, determining which addresses belong to the same local network. Enter an IP address and its CIDR prefix length (the “/24” in an address like 192.168.1.0/24), and this calculator finds the network address, broadcast address, subnet mask, and the range of addresses actually usable by devices.

The Formula

  • Subnet mask: the prefix length’s worth of leading 1 bits, followed by 0 bits (e.g. /24 → 11111111.11111111.11111111.00000000 = 255.255.255.0).
  • Network address: the IP address with a bitwise AND against the subnet mask — this zeroes out the host bits, leaving just the network.
  • Broadcast address: the network address with every host bit set to 1 — the highest address in the subnet.
  • Usable hosts: every address in the subnet except the network and broadcast addresses, since those are reserved — 232Prefix Length22^{32 - \vA{\text{Prefix Length}}} - 2 for ordinary subnets.

Two special cases carve out different rules: a /31 (RFC 3021) is used for point-to-point links and treats both addresses as usable hosts, since there’s no need for a broadcast address between exactly two devices. A /32 is a single-host route — the one address is both the network and its own only usable host.

Worked Example

192.168.1.0/24 (a /24\vA{/24} prefix):

  1. Subnet mask: 255.255.255.0 (24 bits of 1s, then 8 bits of 0s).
  2. Network address: 192.168.1.0.
  3. Broadcast address: 192.168.1.255.
  4. Usable host range: 192.168.1.1 through 192.168.1.254232242=282=2542^{32 - \vA{24}} - 2 = 2^8 - 2 = 254 usable addresses.

Key Factors to Consider

  • Subnetting is how a large network is divided into smaller, more manageable segments. Breaking a network into subnets can improve security (isolating traffic between segments), performance (reducing broadcast traffic on any one segment), and organization — a common practical reason to plan subnets deliberately rather than using one flat, large network.
  • Private IP address ranges (like 192.168.x.x, 10.x.x.x, and 172.16-31.x.x) are reserved for internal networks and never routed on the public internet. These ranges are set aside specifically for local networks like home routers and office LANs — this calculator works identically for private and public address ranges, since the subnetting math itself doesn’t depend on which range an address falls in.
  • A smaller prefix number (like /16) covers a much larger address range than a larger prefix number (like /28). This inverse relationship — fewer bits reserved for the network portion means more bits (and therefore more addresses) available for hosts — can be counterintuitive at first, since the smaller number describes the bigger subnet.
  • IPv6 uses a fundamentally different, much larger addressing scheme than IPv4. This calculator is specifically for IPv4 (32-bit) addresses and CIDR notation — IPv6 uses 128-bit addresses with its own distinct subnetting conventions, not covered by this tool.

Common Mistakes

  • Forgetting to subtract the network and broadcast addresses when counting usable hosts. A /24 has 256 total addresses but only 254 usable ones — the first and last are reserved, a detail that’s easy to overlook when quickly estimating capacity.
  • Assuming /31 and /32 follow the same reserved-address rule as every other prefix. A /31 is specifically designed for point-to-point links and treats both of its addresses as usable, and a /32 is a single address that’s both its own network and host — applying the standard “subtract 2” rule to either gives a wrong (or negative) answer.
  • Confusing which prefix number describes a bigger network. A /16 covers far more addresses than a /28, even though 16 is the smaller number — fewer bits reserved for the network portion leaves more bits, and therefore more addresses, for hosts.
  • Applying IPv4 subnetting math to an IPv6 address. IPv6 uses 128-bit addresses and its own distinct subnetting conventions — this calculator’s formulas only apply to 32-bit IPv4 addresses.

Useful to Know

  • Setting up a home network and need to estimate the bandwidth it should support rather than its addressing? The Internet Speed Requirement Calculator answers that separate question.
  • Working with numbers in a different base as part of networking or programming work? The Number Base Converter Calculator converts between binary, decimal, hexadecimal, and other bases.
  • Need a strong, random password for a router or network device while you’re at it? The Password Generator Calculator creates one to your specified requirements.

Source: CIDR (Classless Inter-Domain Routing) and IPv4 subnetting.

Frequently Asked Questions

What does the CIDR prefix (like /24) mean?

The number after the slash is how many leading bits of the 32-bit IP address are the network portion — a /24 means the first 24 bits identify the network, leaving the remaining 8 bits (256 addresses) for hosts on that network.

Why are 2 addresses subtracted from most subnets?

The lowest address in a subnet is reserved as the network address (identifying the subnet itself) and the highest is reserved as the broadcast address (for sending to every device on the subnet at once) — neither can be assigned to an individual device, which is why usable hosts is 2 less than the total address count.

Why don't /31 and /32 follow the same 2-address rule?

A /31 (RFC 3021) is specifically used for point-to-point links between exactly two devices, where reserving a broadcast address would waste half the available addresses — both addresses are treated as usable hosts instead. A /32 identifies exactly one address (a single host route), so that one address is both the network and its own usable host.

Confirm Your Age

To create an account, please tell us your birth month and year.