Skip to main content
HSCalculadora

Subnet Hosts Calculator

Find usable and total IP addresses from a CIDR prefix.

/bits

The number after the slash, from 0 to 32 (e.g. 24 for /24).

Results update as you type.

Usable hosts
—
Total addresses—

How it works

A subnet hosts calculator tells you how many IP addresses a subnet contains and how many of them can be assigned to actual devices, from a single input: the CIDR prefix length. In modern networking, subnets are written in CIDR notation as an address followed by a slash and a prefix, such as /24, where the prefix says how many leading bits identify the network. The remaining bits are available to number hosts. This matters whenever you plan or troubleshoot a network. Choosing the right subnet size means allocating enough addresses for current devices plus growth, without wastefully carving the address space into blocks far larger than needed. A /24 gives 254 usable addresses, comfortable for a typical office LAN, while a /30 gives just two, ideal for a point-to-point link between routers. Getting the size right keeps addressing efficient and routing tidy. The calculation rests on binary arithmetic. An IPv4 address has 32 bits; the prefix fixes the network bits, and the 32 minus the prefix host bits each double the number of addresses, so the total is two to that power. A standard subnet reserves two addresses, the network identifier and the broadcast address, so usable hosts equal the total minus two. Very small prefixes like /31 and /32 are special cases used for links and single hosts. Network engineers, administrators, and students use a subnet hosts calculator to size IPv4 subnets correctly.

Formula

total = 2^(32 − prefix) · usable = total − 2

An IPv4 address is 32 bits long. A CIDR prefix fixes the leftmost bits as the network portion, leaving 32 minus the prefix bits free to number hosts. Since each free bit doubles the count, the total addresses equal two raised to that many bits. Two of those addresses are reserved in a standard subnet: the all-zeros network address and the all-ones broadcast address, so the usable host count is the total minus two.

Source:CIDR / IPv4 addressing (RFC 4632)

We review all our tools from time to time to ensure accuracy.

Worked example

CIDR prefix length:24
A /24 leaves 8 host bits, so 2^8 = 256 total addresses and 256 − 2 = 254 usable hosts.

How to use this calculator

  1. 1

    Enter your values

    Enter cidr prefix length.

  2. 2

    Adjust the options

    Fine-tune any options to match your situation.

  3. 3

    Read your result

    Usable hosts updates instantly as you type — no button to press.

Frequently asked questions

Why are two addresses subtracted from the total?

In a standard IPv4 subnet, two addresses are reserved and cannot be assigned to devices. The first, with all host bits set to zero, is the network address that identifies the subnet itself. The last, with all host bits set to one, is the broadcast address used to reach every device at once. Because these two are unusable for individual hosts, the usable count is always the total minus two.

What does the CIDR prefix number mean?

The prefix, the number after the slash, counts how many of the 32 bits in an IPv4 address are fixed as the network portion. A larger prefix means more network bits and fewer host bits, so a smaller subnet. A /24 fixes 24 bits and leaves 8 for hosts, while a /28 fixes 28 and leaves only 4. Each additional prefix bit halves the number of addresses in the subnet.

How do I choose the right subnet size?

Count the devices you need to address now and allow room for growth, then pick the smallest prefix that provides enough usable hosts. For a point-to-point router link, a /30 with two usable addresses suffices. A small office might use a /24 for 254 hosts. Oversizing wastes address space and can complicate routing, while undersizing forces renumbering later, so match the block to realistic need plus a margin.

What are /31 and /32 subnets used for?

These are special cases. A /32 identifies a single host address, often used for loopbacks or host routes. A /31, defined by RFC 3021, provides exactly two addresses with no separate network or broadcast reservation, making it efficient for point-to-point links between two routers. Because they break the usual minus-two rule, treat them as purpose-built exceptions. This calculator applies the standard reservation, so verify special cases against your equipment's support.

Does this apply to IPv6 as well?

No, this calculator is for IPv4, which uses 32-bit addresses. IPv6 uses 128-bit addresses and vastly larger subnets, typically a /64 for a single network, which holds an astronomically large number of addresses. IPv6 also does not reserve a broadcast address in the same way, so the minus-two rule does not apply. For IPv6 planning, use a dedicated IPv6 subnet tool rather than this IPv4-based calculator.