Skip to the tool
DevToolBench

CIDR Calculator

IPv4 prefixes, host ranges and usable counts.

192.168.1.0/24
Netmask
255.255.255.0
Wildcard
0.0.0.255
Network
192.168.1.0
Broadcast
192.168.1.255
First host
192.168.1.1
Last host
192.168.1.254
Total addresses
256
Usable hosts
254
Class
C
Scope
Private (RFC 1918)

Everything runs in your browser. Nothing you type is sent to a server.

Found a bug in this tool? Report it.

Share this tool

What this tool does

This CIDR calculator takes an IPv4 block such as 192.168.1.130/26 and works out everything the prefix implies: the netmask and its wildcard, the network and broadcast addresses, the first and last usable host, the total address count and how many of those you can actually assign. Paste a host address rather than a network address and it tells you which network that host belongs to, which is usually the question you meant to ask.

Two extras sit underneath. A subnet mask in dotted form converts back to a prefix, for when a config file gives you 255.255.254.0 and you need to know it is a /23. And an arbitrary start-and-end range converts into the shortest list of CIDR blocks that covers it exactly — the calculation you need when a firewall rule accepts prefixes but the requirement arrived as "from this address to that one".

What the number after the slash means

The prefix length is the count of bits, from the left, that identify the network. The rest identify the host. A /24 fixes the first 24 bits, leaving 8 for hosts, which is 256 addresses; a /26 fixes 26 bits and leaves 64.

Every bit you take from the host side halves the block. That single fact makes the whole table memorable: /24 is 256, /25 is 128, /26 is 64, /27 is 32, /28 is 16. Going the other way doubles: a /23 is two /24s that happen to be adjacent and aligned.

Alignment is the constraint people forget. A block must start on a multiple of its own size, so 192.168.4.0/23 is legal and 192.168.5.0/23 is not, because 5 is not a multiple of 2. This is also why splitting a range that begins one address above a boundary produces a long list of blocks rather than one tidy prefix.

Why two addresses are usually missing

In a normal subnet the lowest address is the network identifier and the highest is the directed broadcast. Neither can be assigned to an interface, which is where "total minus two" comes from.

The exceptions are worth knowing because most calculators get them wrong. A /31 has two addresses and no network or broadcast at all: RFC 3021 gives both to the two ends of a point-to-point link, so the honest answer is two usable hosts, not zero. A /32 is a single address — a host route, the shape you see in routing tables and firewall rules — and the honest answer is one, not minus one. This calculator reports both cases as they are and explains the exception under the results.

Private, reserved, and everything else

Three ranges are reserved for internal use by RFC 1918: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. The middle one causes trouble because /12 stops at 172.31.255.255, not at 172.255.255.255. Alongside those, the tool recognises loopback (127.0.0.0/8), link-local (169.254.0.0/16, the address your machine gives itself when DHCP fails), carrier-grade NAT (100.64.0.0/10), the documentation ranges from RFC 5737 and multicast space, and labels anything else as globally routable.

Class A, B and C are reported too, because certification exams and older documentation still use them. They have not governed routing since classless inter-domain routing arrived in 1993 — the prefix does that job now — so treat the class as trivia rather than as an answer.

Working on the same box? The number base converter shows the same masks in binary, where the contiguous run of ones is visible, and the chmod calculator covers the other set of bits you will be arguing about on that server.

Frequently asked questions

How many usable hosts are in a /24?

254. A /24 holds 256 addresses, and two of them are spoken for: the lowest is the network identifier and the highest is the directed broadcast. Every prefix from /0 to /30 follows the same rule, so a /25 gives 126 and a /26 gives 62. The exceptions start at /31, where the arithmetic changes entirely.

Why does a /31 have two usable hosts instead of none?

Because RFC 3021 says so. A /31 covers exactly two addresses, and the old rule would consume both on the network and broadcast identifiers, leaving nothing. On a point-to-point link neither identifier is needed — there is only one other end to talk to — so the RFC assigns both addresses to hosts. Routers have supported this since the early 2000s, and it halves the address waste on links that used to take a /30.

What is the difference between a wildcard mask and a subnet mask?

They are bitwise inverses. A subnet mask of 255.255.255.0 has the same meaning as a wildcard of 0.0.0.255, but the tools that consume them differ: interface configuration and routing take the subnet mask, while Cisco access lists and OSPF network statements take the wildcard. Writing one where the other is expected produces a rule that silently matches the wrong traffic.

Which address ranges are private?

RFC 1918 reserves three: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Note the middle one — it runs from 172.16.0.0 to 172.31.255.255, not to 172.255.255.255, which is the single most common misreading. The calculator names the range for any address you paste, including loopback, link-local and carrier-grade NAT.

Does this calculator handle IPv6?

Not yet. IPv6 prefixes need 128-bit arithmetic and a different set of answers — there is no broadcast address and host counts stop being meaningful somewhere around a /64 — so bolting it onto an IPv4 tool would produce a worse version of both. This page is IPv4 only, and says so rather than guessing.

Related tools

Updated