ForHosting KIT · Developer Utilities

CIDR first and last usable host calculator

192.168.1.0/24 gives usable hosts 192.168.1.1 through 192.168.1.254, 254 addresses once the network and broadcast are set aside. Paste any IPv4 block, even with a host address inside it, and get the first and last addresses you can actually assign. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Cidr
192.168.1.0/24
You get
Prefix
24
Network
192.168.1.0
Broadcast
192.168.1.255
First host
192.168.1.1

Network engineers, CCNA students, and anyone who assigns addresses from an IPv4 subnet need the first and last usable host addresses, not the network identifier and not the directed broadcast. This CIDR first and last usable host calculator accepts a standard IPv4 CIDR block, derives the network and broadcast addresses with integer masking, and returns the inclusive usable host range after those two reserved addresses are excluded. Paste 192.168.1.0/24 and you receive 192.168.1.1 through 192.168.1.254. A host address inside the block is normalized to the network first, so 192.168.1.50/24 yields the same range. Point-to-point /31 prefixes follow RFC 3021 (both addresses are usable). A /32 host route is treated as a single usable address.

What first and last usable hosts mean on an IPv4 subnet

On an IPv4 subnet the first address of the block is the network identifier and the last address is the directed broadcast. Neither is assigned to an interface on a normal multi-access LAN. The first usable host is therefore the address immediately after the network, and the last usable host is the address immediately before the broadcast.

For the familiar slash-twenty-four example 192.168.1.0/24 the network is 192.168.1.0, the broadcast is 192.168.1.255, and the usable range is 192.168.1.1 through 192.168.1.254 — two hundred fifty-four addresses. The same rule scales: a /16 has 65,534 usable hosts; a /30, used on many point-to-point links before RFC 3021, has exactly two. This calculator exists so you do not have to convert the prefix to a mask, bitwise-AND the address, invert the mask, and add or subtract one by hand.

Where the usable host range helps

Addressing worksheets, firewall change tickets, and lab automations all need the same two addresses: the lowest and highest hosts you may assign. A junior engineer documenting a /27 for a printer VLAN wants 10.0.0.1 as the gateway and 10.0.0.30 as the last printer, not 10.0.0.0 or 10.0.0.31. A change ticket that opens TCP 443 to a vendor circuit should list the usable ends so the ACL does not accidentally include the broadcast.

Exam prep and CCNA-style drills use the same contract as an oracle: given a CIDR, what are the first and last usable hosts? Invalid CIDR strings are rejected before any arithmetic and do not consume balance.

DHCP pools and static assignment sheets

Turn a CIDR block into the first and last addresses you may hand to hosts or reserve as the default gateway, without listing the network or broadcast.

Firewall and ACL bounds

Document the inclusive usable range on a change ticket so the rule matches assignable hosts and does not open the directed broadcast.

How do I find the first and last usable hosts in a CIDR block?

Send cidr as IPv4 dotted-quad/prefix (for example 192.168.1.0/24).

Why are the network and broadcast addresses excluded?

On a multi-access IPv4 LAN the first address identifies the subnet and the last is the directed broadcast. Assigning either to a host breaks routing or floods the segment, so they are not usable hosts.

Can I paste a host address such as 192.168.1.50/24?

Yes. The engine masks the address to the network (192.168.1.0/24) and then computes the usable range from that network, so a paste from ifconfig or a ticket still works.

What about /31 and /32 blocks?

A /31 is a two-address point-to-point link under RFC 3021: there is no network or broadcast, so both addresses are usable. A /32 is a host route, so the first and the last host are the same single address.

How do I choose a gateway and the last address for devices?

Take the two ends of the usable range. For a /27 starting at 10.0.0.0, the gateway can be 10.0.0.1 and the last device 10.0.0.30; never 10.0.0.0 or 10.0.0.31, which are the network and broadcast addresses.

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-first-last-host

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-first-last-host \
  -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_first_last_host",
  "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.

What first and last usable hosts mean on an IPv4 subnet

You send the CIDR block; you get first_host, last_host, and usable_host_count, plus the reserved network and broadcast so you can see what was excluded. That is the search people type when they already know the subnet and only need the assignable ends of the range, which is a different job from a full subnet planner that also splits networks or prints wildcard masks for access lists.

Input contract, CIDR parsing, and special prefixes

Whitespace around the slash is ignored. If you paste a host that already sits inside the block — 10.20.30.40/16 — the engine masks the address to the network 10.20.0.0/16 and then computes the usable range from that network, so DHCP pools and ACL comments stay aligned with the official block. Prefixes 0 through 30 exclude the network and broadcast in the classic way. Send a JSON body with the required field cidr, an IPv4 dotted-quad followed by a slash and a prefix from 0 to 32. The aliases block and network are accepted and mean the same thing. A /31 is a two-address point-to-point prefix under RFC 3021: there is no reserved network or broadcast, so both addresses are usable and excludes_reserved is false. A /32 is a host route: first_host and last_host are the same address and the usable count is one. IPv6, missing prefixes, octets outside 0–255, and prefixes outside 0–32 fail with invalid_input naming cidr; those failures are not billed. On success the body echoes the normalized cidr (network/prefix), the integer prefix, network, broadcast, first_host, last_host, usable_host_count, and excludes_reserved so clients can render a single line or branch on the special prefixes without re-implementing the arithmetic.

Where a first-and-last usable host API earns its keep

Successful API calls cost the published $0.002 base price with no model tokens and no outbound lookup. Keep the input to a single IPv4 block, pin first_host and last_host in tests, and you get a deterministic range you can paste into DHCP, DNS reverse zones, or a spreadsheet without standing up a full IPAM stack of your own.

CCNA labs and homework checks

Give students a CIDR and verify first_host, last_host, and usable_host_count against the classic exclude-network-and-broadcast method.

What happens with a /31 or a /32?

A /31 follows RFC 3021: both addresses are usable and excludes_reserved is false. A /32 is a host route, so first_host and last_host are the same address and the usable count is one.

What does the CIDR first and last usable host calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →