ForHosting KIT · Developer Utilities

CIDR usable hosts calculator

This CIDR usable hosts calculator turns an IPv4 address and prefix into the exact network boundary, broadcast address, total address count, and usable host count.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

It accepts ordinary subnet notation such as 192.168.1.0/24 and also normalizes an address entered from inside a block. Special-purpose /31 point-to-point networks and /32 host routes are counted correctly instead of blindly losing two addresses. The calculation is deterministic, local, and suitable for quick planning as well as automated validation.

Read total addresses and usable hosts correctly

An IPv4 prefix tells you how many of the 32 address bits identify the network. The remaining bits identify addresses inside that network, so the total is two raised to the number of remaining bits. For example, a /24 leaves eight bits and therefore contains 256 addresses. In conventional subnets from /0 through /30, the first address identifies the network and the last is the broadcast address. Those two addresses are not normally assignable to hosts, which leaves 254 usable hosts in a /24. This calculator reports both numbers because they answer different planning questions: total addresses describes the allocated block, while usable hosts describes ordinary interface capacity. It also returns the normalized network and broadcast boundaries, making it easy to verify whether an address belongs where you expect. The reserved count makes the subtraction explicit. Counts are exact integers, including the 4,294,967,296 addresses represented by the complete IPv4 /0 space, so the result is useful for inventories, documentation, and validation rules without relying on a table of memorized subnet sizes.

Understand the special rules for /31 and /32

The familiar rule of subtracting two addresses has two important exceptions. A /31 contains exactly two addresses. On a point-to-point link, there is no need for separate network and broadcast destinations, so both addresses can identify the two endpoints under the widely deployed /31 convention. The calculator therefore reports two total and two usable addresses, with zero reserved. A /32 contains one address and represents a single host route rather than a conventional multi-host subnet. That sole address is usable for the represented host, so the result is one total, one usable, and zero reserved. Treating either prefix with a mechanical subtraction would produce zero or even a negative answer, which is misleading in routing plans and automation. The output still includes network and broadcast fields for a consistent response shape: for /32 both are the same address, while for /31 they are the two endpoints. Always consider equipment support and local policy before deploying /31 links, but use these counts when modeling modern IPv4 semantics.

Use normalized boundaries in network planning

You may enter any IPv4 address with a prefix, not only an address already written at the network boundary. If you submit 192.168.1.37/24, the calculator normalizes it to 192.168.1.0/24 and reports 192.168.1.255 as the broadcast address. This behavior is valuable when reviewing firewall objects, host inventories, cloud network plans, or configuration generated by another system: it exposes the actual block instead of echoing a potentially misleading host address. Validate user input before provisioning, compare the returned normalized CIDR with the intended allocation, and use usable_hosts for capacity checks. Remember that a mathematically usable address may still be withheld by a cloud provider, appliance, or organizational policy; provider-specific gateway and service reservations are outside this generic IPv4 calculation. The endpoint performs no DNS lookups and does not inspect a live network. It only parses dotted-decimal IPv4 CIDR notation and applies deterministic bit-boundary arithmetic. That makes repeated results stable and safe to include in build pipelines, infrastructure review tools, address-management imports, and educational subnet exercises.

Size a subnet

Check whether a proposed IPv4 prefix provides enough usable host addresses before allocating it.

Validate network configuration

Normalize a host address with its prefix and compare the resulting network and broadcast boundaries with a configuration.

Model point-to-point links

Count both endpoints of a /31 correctly when planning router links without wasting a larger subnet.

What does it cost?

The API costs $0.002 per request, and the browser calculator is free to run.

Why are two addresses usually subtracted?

For prefixes /0 through /30, the first address identifies the network and the last is the broadcast address, leaving the addresses between them usable.

How many usable hosts are in a /31?

A /31 has two usable addresses for the endpoints of a point-to-point link and no separately reserved network or broadcast address.

How many usable hosts are in a /32?

A /32 represents one host address, so both its total address count and usable host count are one.

Can I enter a host address instead of the network address?

Yes. The calculator normalizes it to the actual network boundary for the supplied prefix.

Does the usable count include cloud-provider reservations?

No. It applies standard IPv4 CIDR rules only; additional addresses reserved by a provider or local policy must be subtracted separately.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/dev/cidr-host-count

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/dev/cidr-host-count \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cidr":"192.168.1.0/24"}'
{
  "cidr": "192.168.1.0/24"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "dev.cidr_host_count",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →