CIDR / Subnet Calculator

Parses an IPv4 CIDR block and shows the network address, broadcast address, subnet and wildcard masks, usable host range and address type. Every calculation runs in your browser.

Last updated:

CIDR Block
E.g. 10.0.0.0/16 · 192.168.1.0/24 · 172.16.5.0/22. Prefix must be 0-32.

Results

192.168.1.0 Network address
Prefix length
/24
Broadcast address
192.168.1.255
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
First usable host
192.168.1.1
Last usable host
192.168.1.254
Usable hosts
254
Total addresses
256
IP class
C
Address type
Private (RFC 1918)

When this calculation actually matters

Sizing point-to-point links

Router-to-router links only ever need two addresses, yet they are routinely carved from /30s out of habit. Across dozens of links the waste adds up quickly, and the worked example below puts a number on it.

Checking whether two ranges overlap

Before peering two VPCs or connecting an acquired company's network, you need to know whether the ranges collide. Both sides sitting somewhere inside 10.0.0.0/8 tells you nothing; comparing network and broadcast boundaries settles it.

Decoding a colleague's firewall rules

An ACL written with wildcard masks reads backwards compared to subnet masks: 0.0.0.63 and 255.255.255.192 describe the same /26. Translating between the two forms before touching a production rule set is cheap insurance.

Worked example: 40 router links, /30 versus /31

A WAN redesign needs 40 point-to-point links between sites. The question is how much address space to reserve, and the answer depends on one RFC.

  1. A /30 holds 2^(32 − 30) = 4 addresses, of which 2 survive after network and broadcast.
  2. 40 links on /30s consume 40 × 4 = 160 addresses; the smallest block containing 160 is a /24 (256).
  3. RFC 3021 allows /31s on point-to-point links: both of its 2 addresses are usable.
  4. 40 links on /31s consume 40 × 2 = 80 addresses; a /25 (128) now fits with headroom.
  5. Switching the standard halves the burn: 160 down to 80, and the reserved block shrinks from /24 to /25.

The /31 convention is supported by effectively all current routing platforms, but it is still a deliberate choice: older equipment and some virtual appliances silently expect /30 semantics. Reserve the /25 only after confirming both ends speak RFC 3021, otherwise the clean math turns into an interface that refuses its address.

Four mistakes worth avoiding

Applying the minus-two rule everywhere

Usable hosts = total − 2 holds from /1 to /30, then stops. A /31 keeps both addresses (RFC 3021) and a /32 is a single host route. Capacity plans that apply the old rule to link subnets undercount by exactly half.

Letting cloud and cluster ranges collide

A Kubernetes pod CIDR that overlaps the VPC it runs in produces traffic that leaves the cluster and never comes back. The failure appears days later as unreachable external services, long after the innocent-looking CIDR choice.

Starting a block off its boundary

A /27 can only begin at multiples of 32. Writing 172.16.5.48/27 into a config makes the device normalise it to 172.16.5.32/27, and the range you thought you defined is not the range that exists.

Reserving by device count instead of growth

A subnet sized exactly for today's hosts is full on the day the next device arrives, and resizing means renumbering. One prefix step larger doubles the room and costs nothing while the space is otherwise unused.

Tools commonly used alongside this one

  • Kubernetes Resource Budget Calculator Estimate how many nodes you need, your packing efficiency, and the projected monthly cost from pod requests and node size.
  • Cron Expression Parser Parse a cron expression field by field and see the next run times. For Kubernetes CronJobs and scheduled tasks.
  • Epoch / Unix Timestamp Converter Convert Unix epoch timestamps to readable dates and back. Seconds and milliseconds are auto-detected.
  • Hash Generator (SHA) Compute SHA-1, SHA-256, SHA-384 and SHA-512 digests of text instantly. Via the Web Crypto API, in the browser.
  • HTML / Entity Encoder-Decoder Encode text to HTML entities or decode it back. Escape special characters to prevent XSS; in the browser, no signup.

Frequently Asked Questions

What is CIDR notation?

CIDR (Classless Inter-Domain Routing) notation writes an IP address followed by a slash and a prefix length — e.g. 10.0.0.0/16. The prefix says how many bits form the network part of the address; the remaining bits are host addresses.

Why is the usable host count two fewer than the total addresses?

In every subnet the first address is the network address and the last is the broadcast address; neither is assigned to a host. So usable hosts = total − 2. Two exceptions: a /31 defines 2 usable addresses for point-to-point links (RFC 3021), and a /32 represents a single host.

Which IP ranges are private?

RFC 1918 defines three private ranges: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. These addresses are not routed on the internet; they are used on local networks and behind NAT. Additionally 127.0.0.0/8 is loopback and 169.254.0.0/16 is link-local.

What are the Pod CIDR and Service CIDR in Kubernetes?

A Kubernetes cluster assigns pod IPs from one CIDR block (the pod network CIDR, e.g. 10.244.0.0/16) and Service IPs from a separate block (the service CIDR, e.g. 10.96.0.0/12). The two blocks must not overlap with each other or with the node network — an overlap causes routing failures.

How many addresses do /24, /16 and /8 hold?

A /24 holds 256 addresses (254 usable hosts), a /16 holds 65,536 addresses (65,534 hosts), and a /8 holds 16,777,216 addresses. The address count is 2^(32 − prefix) — each bit shorter doubles the block.