CIDR Calculator

Enter an IPv4 address and CIDR prefix length to compute the network address, broadcast address, subnet mask, and usable host range for that subnet.

Quick Facts

Usable hosts
2^(32 − prefix) − 2
The first address is the network id, the last is the broadcast address.
Exceptions
/31 = 2 hosts, /32 = 1 host
RFC 3021 lets /31 point-to-point links use both addresses.
Private ranges
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
Reserved for internal networks under RFC 1918.

Your Results

Calculated
Network address
-
First address in the block (host bits = 0)
Broadcast address
-
Last address in the block (host bits = 1)
Subnet mask
-
Dotted-decimal mask for this prefix
Usable hosts
-
Assignable addresses in the subnet

Ready

Enter an IPv4 address and prefix length, then press Calculate.

Understanding CIDR Notation

CIDR (Classless Inter-Domain Routing) notation writes an IPv4 address together with a prefix length, like 192.168.1.0/24. The prefix length — the number after the slash — states how many of the address's 32 bits are fixed as the "network" portion; the remaining bits identify individual hosts within that network. CIDR replaced the older class-based (A/B/C) system in 1993, letting networks be sized to the number of hosts actually needed instead of fixed 8-, 16-, or 24-bit blocks.

The formulas

For an address with prefix length n (0–32), the calculator applies standard bitwise arithmetic:

  • Subnet mask: n leading 1-bits followed by (32 − n) trailing 0-bits, written in dotted-decimal (e.g. /24 → 255.255.255.0).
  • Network address: the entered IP address with a bitwise AND against the subnet mask (all host bits forced to 0).
  • Broadcast address: the network address with all host bits forced to 1 (a bitwise OR against the wildcard mask).
  • Total addresses: 2^(32 − n) — every address in the block, including network and broadcast.
  • Usable hosts: 2^(32 − n) − 2 for prefixes /0 through /30, since the network and broadcast addresses cannot be assigned to a host. The exceptions are /31, where RFC 3021 permits both addresses to be used on point-to-point links, and /32, a single host route.

Common prefix reference

  • /8 — 16,777,216 addresses, 16,777,214 usable hosts (mask 255.0.0.0).
  • /16 — 65,536 addresses, 65,534 usable hosts (mask 255.255.0.0).
  • /24 — 256 addresses, 254 usable hosts (mask 255.255.255.0) — the most common LAN subnet size.
  • /30 — 4 addresses, 2 usable hosts (mask 255.255.255.252) — a classic router-to-router link.
  • /32 — 1 address, used as a host route.

Private and reserved ranges

RFC 1918 sets aside three blocks for private, non-internet-routable networks: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. Addresses outside these blocks (and outside other reserved ranges like 127.0.0.0/8 for loopback and 169.254.0.0/16 for link-local) are generally public, internet-routable addresses.

Frequently Asked Questions

What does the CIDR prefix (the /24) actually mean?
The number after the slash is how many leading bits of the 32-bit IPv4 address are fixed as the network portion. A /24 fixes the first 24 bits, leaving 8 bits (2^8 = 256 addresses) for hosts. A smaller prefix like /16 fixes fewer bits and covers a larger block; a larger prefix like /30 fixes more bits and covers a smaller block.
How do I calculate the number of usable hosts from a prefix?
Usable hosts = 2^(32 minus the prefix length) minus 2, because the first address in the block is reserved as the network address and the last is reserved as the broadcast address. A /24 gives 2^8 − 2 = 254 usable hosts. The two exceptions are /31, which RFC 3021 allows to use both addresses for point-to-point links, and /32, a single host address.
What is the difference between the subnet mask and the wildcard mask?
The subnet mask has 1-bits for the network portion and 0-bits for the host portion (255.255.255.0 for /24). The wildcard mask is its bitwise complement — 0-bits for the network portion and 1-bits for the host portion (0.0.0.255 for /24). Wildcard masks are used mainly in Cisco access-control list configuration.
What are the network and broadcast addresses used for?
The network address (all host bits set to 0) identifies the subnet itself and cannot be assigned to a device. The broadcast address (all host bits set to 1) is used to send a packet to every host on that subnet simultaneously. Neither is available for individual host assignment on subnets of /30 or larger blocks.