DevTools Hub

Search tools

Search for a developer tool

CIDR Explained

Part of the Network Security Toolkit

192.168.1.0/24 shows up everywhere — router configuration pages, cloud network settings, firewall rules — and most people learn to recognize it as "a home network" without ever unpacking what the /24 actually does. It's not decoration: it's the single number that determines how many devices the network can hold, which addresses are reserved, and which ones are actually assignable. This post covers what that number means at the bit level, works through the arithmetic by hand, and covers the edge cases that trip people up.

An IP address is just a 32-bit number

192.168.1.10 is really the 32-bit binary number 11000000.10101000.00000001.00001010, split into four 8-bit groups (octets) purely for human readability — the dots don't mean anything to the underlying math, they're just where humans prefer to insert commas. Each octet ranges from 00000000 to 11111111 in binary, or 0 to 255 in decimal, which is exactly why every valid octet in an IPv4 address is a number from 0 to 255 and never anything else. The entire address space is 232, a little over 4.3 billion possible addresses — the number that made the internet eventually run out of fresh IPv4 space and is the whole reason RFC 1918 private ranges and, longer-term, IPv6 exist at all.

What the prefix length actually means

CIDR notation — Classless Inter-Domain Routing, introduced in 1993 to replace the older rigid Class A/B/C system — appends a slash and a number to an address: /24. That number is the prefix length: how many bits, counting from the left, are fixed as the network portion of the address. Every bit after that is free to vary and identifies a specific host within that network. Written out for 192.168.1.10/24:

11000000.10101000.00000001.00001010
└──────────── network (24 bits) ────────────┘└── host (8 bits) ──┘

The first 24 bits — 192.168.1 — are fixed for every device on this network. The remaining 8 bits can be anything from 00000000 to 11111111, giving 28 = 256 possible values, which is exactly why a /24 subnet has 256 total addresses. A shorter prefix (/16) fixes fewer bits and leaves more free for hosts — a much larger network. A longer prefix (/28) fixes more bits and leaves fewer for hosts — a much smaller one. The general formula, and the one this calculator actually runs, is 2(32 − prefix length) total addresses.

Subnet masks: the older way to say the same thing

Before CIDR notation was common, the same information was written as a subnet mask — a dotted-decimal number with all the network-portion bits set to 1 and all the host-portion bits set to 0. A /24 prefix is the mask 255.255.255.0; a /16 prefix is 255.255.0.0. Both notations describe the identical division of bits — CIDR notation is just shorter to write and, not coincidentally, easier to get right, since counting to 24 is harder to mess up than typing four correct octets of a mask by hand.

Converting between them is direct: count consecutive 1 bits from the left of the mask to get the prefix length, or fill that many 1 bits from the left (and 0s for the rest) to get the mask back from a prefix length. A subnet mask is never anything other than a run of 1s followed by a run of 0s — a mask like 255.0.255.0 isn't valid, because it can't be expressed as a single contiguous prefix length at all.

Network address and broadcast address

Within any subnet, two addresses are set aside and can't be assigned to an individual host:

  • The network address — every host bit set to 0 — identifies the subnet itself, the way a street name identifies a street rather than any specific house on it.
  • The broadcast address — every host bit set to 1 — is reserved for sending one packet that every device on the subnet receives at once, rather than addressing any single one of them.

That's why the usable host count is the total address count minus 2 for any ordinary subnet: a /24's 256 total addresses become 254 usable ones once the network and broadcast addresses are set aside on either end of the range.

A worked example, step by step

Take 192.168.1.10/24 and work out what a router actually computes:

  1. Convert the mask. /24 is 255.255.255.0 — the first three octets are the network portion, the last octet is the host portion.
  2. Find the network address. Zero out the host portion of the given address: 192.168.1.10 becomes 192.168.1.0. Notice the input address didn't have to already be the network address — any address inside the subnet resolves to the same network once its host bits are masked off.
  3. Find the broadcast address. Set every host bit to 1 instead: 192.168.1.255.
  4. Find the usable range. Everything strictly between the two: 192.168.1.1 through 192.168.1.254 — 254 addresses.

Every field a CIDR Calculator shows comes directly out of these four steps — there's no additional magic, just bit arithmetic applied consistently.

A quick-reference table of common prefixes

Prefix   Mask              Total addresses   Usable hosts
/8       255.0.0.0         16,777,216        16,777,214
/16      255.255.0.0       65,536            65,534
/24      255.255.255.0     256               254
/25      255.255.255.128   128               126
/26      255.255.255.192   64                62
/27      255.255.255.224   32                30
/28      255.255.255.240   16                14
/29      255.255.255.248   8                 6
/30      255.255.255.252   4                 2
/31      255.255.255.254   2                 2 (RFC 3021)
/32      255.255.255.255   1                 1

Notice the pattern moving down the table: every step from one prefix to the next longer one exactly halves the total address count. That's the same doubling relationship as any binary system — going from /23 to /24 doesn't just make the network "a bit smaller," it makes it exactly half the size, every single time.

Subnetting: splitting one network into several

Subnetting is the practice of taking one allocated network and dividing it into smaller ones by lengthening the prefix — borrowing bits that used to be part of the host portion and making them part of the network portion instead. Given 192.168.1.0/24, lengthening the prefix to /26 borrows 2 bits from the host portion, producing four /26 subnets of 64 addresses each:

192.168.1.0/26     (.0   - .63,  62 usable)
192.168.1.64/26    (.64  - .127, 62 usable)
192.168.1.128/26   (.128 - .191, 62 usable)
192.168.1.192/26   (.192 - .255, 62 usable)

This is exactly how a cloud provider carves one large VPC address range into separate subnets for different availability zones or tiers (a public-facing subnet, a private database subnet), and how an office network separates departments onto logically distinct segments without needing physically separate network hardware for each one. Every additional bit borrowed doubles the number of subnets available and halves the number of hosts each one can hold — the same fixed tradeoff in the other direction from the table above.

Supernetting: the problem CIDR was actually invented to solve

Subnetting divides one network into smaller ones; supernetting — the reverse — combines several smaller, contiguous networks into one larger block that can be described (and routed) as a single entry. This, not subnetting, is the specific problem CIDR was created to solve in 1993: internet routing tables were growing explosively under the old classful system, because an organization with, say, eight separate Class C (/24) allocations needed eight separate entries in every router on the internet just to describe address ranges that were often contiguous and could have been one entry all along.

CIDR made it possible to allocate 203.0.112.0/21 instead — a single block covering the same address range as eight contiguous /24s (2(24−21) = 8), routed as one table entry rather than eight. This technique, called route aggregation or route summarization, is the direct ancestor of why CIDR notation exists at all — subnetting within an organization's own network turned out to be a natural, equally useful application of the same underlying idea, but it was the routing table explosion that CIDR was actually built to fix.

Private address ranges and CIDR

RFC 1918 sets aside three blocks of IPv4 address space for private networks — addresses that are never routed on the public internet and can be reused independently inside any organization's own network:

10.0.0.0/8        (16,777,216 addresses)
172.16.0.0/12     (1,048,576 addresses)
192.168.0.0/16    (65,536 addresses)

Every one of these is itself just a CIDR block, sized differently to suit different organization sizes — a /8 for very large private networks, a /16 for the common home and small-office case. Nearly every home router defaults to something inside 192.168.0.0/16, most often further subnetted down to a specific /24 like 192.168.1.0/24, which is exactly why that particular /24 is the single most common subnet in the world despite being privately reused, unchanged, in millions of separate networks simultaneously.

Special cases worth knowing

  • /32 identifies exactly one address with no room for a separate network or broadcast address — used for host routes, where a routing table needs to point at one specific address rather than an entire range.
  • /31, per RFC 3021, is a deliberate exception built for point-to-point links (a direct connection between exactly two routers): rather than wasting 2 of only 4 available addresses on a network and broadcast address that serve no purpose on a link with only two possible endpoints, both addresses are usable host addresses.
  • /0 matches the entire IPv4 address space in a single range. It shows up almost exclusively as a default route in routing tables ("anything not matched by a more specific route goes here"), essentially never as an actual assigned subnet.

Common mistakes

  • Assuming the number of usable hosts is the total address count. It's always 2 less for any /30 or shorter prefix — forgetting the network and broadcast addresses is the single most common off-by-two error in subnet planning.
  • Sizing a subnet for today's host count with zero headroom. A department with 50 machines today easily grows past a /26's 62 usable addresses; sizing with room to grow avoids an unplanned re-addressing project later.
  • Treating a subnet mask like an arbitrary dotted-decimal number. A valid mask is always a contiguous run of 1 bits followed by 0 bits — if it can't be written as a single CIDR prefix length, it isn't a valid subnet mask at all.

FAQ

Is a CIDR calculator the same as a subnet calculator?

Yes — CIDR notation and dotted-decimal subnet masks describe exactly the same information two different ways, so a CIDR calculator and a subnet calculator answer the same question and produce the same network address, broadcast address, and host range.

Why is a /24 the most common home and small-office subnet size?

It gives 254 usable host addresses — comfortably more than most home or small-office networks need, while small enough that a compromised or malfunctioning host can't flood an enormous broadcast domain. It's also a clean fit with the legacy Class C range, which is why so many default router configurations (192.168.1.0/24, 192.168.0.0/24) still use it.

Can two devices with the same IP address exist on different subnets?

Yes — 192.168.1.10/24 and 192.168.1.10/25 could both exist on physically or logically separate networks without conflict, since routing decisions are made based on the network address each subnet actually resolves to, not the raw IP text. The prefix length is what makes the same-looking address unambiguous.

What happens if I use the wrong subnet mask on a device?

The device miscalculates which addresses are "local" (reachable directly) versus which need to go through a router — too narrow a mask (a longer prefix than the network actually uses) makes some genuinely local devices look remote and routes traffic to them incorrectly; too wide a mask (a shorter prefix) can make remote devices look local, and packets meant for them never leave the network.

Does IPv6 use CIDR notation too?

Yes — the slash-prefix syntax is identical in concept, though IPv6 addresses are 128 bits rather than 32, and subnetting conventions differ in practice (a /64 is the near-universal subnet size for an IPv6 LAN, rather than the varied prefix lengths common in IPv4). This calculator covers IPv4 specifically.

Try it yourself

CIDR Calculator runs every calculation in this post — network address, broadcast address, usable host range, and a binary breakdown of exactly which bits are network and which are host — for any IPv4 address and prefix length, entirely in your browser. On the email side of network configuration, see SPF Records Explained.

Related tools