Subnet CIDR Calculator
CIDR (Classless Inter-Domain Routing) subnet notation encodes an IPv4 network address and its prefix length in a compact form like 192.168.1.0/24. The prefix length determines how many of the 32 IP address bits are the network portion, with the remaining bits available for host addresses. The total address count is 2 raised to (32 minus prefix), and subtracting the network and broadcast addresses gives the count of usable host addresses. This calculator takes a CIDR prefix length and returns the total addresses, usable hosts, subnet mask, and wildcard mask.
CIDR subnet formula
Total addresses = 2(32 - prefix)
Usable hosts = 2(32 - prefix) - 2
Subnet mask: prefix bits set to 1, host bits set to 0
Wildcard mask: inverse of subnet mask
For /24: total = 2^8 = 256, usable = 254, mask = 255.255.255.0. For /30 (commonly used for point-to-point links): total = 4, usable = 2, mask = 255.255.255.252.
Common CIDR subnet sizes
- /8: 16,777,214 usable hosts. Used for large enterprise or ISP allocations.
- /16: 65,534 usable hosts. Common for campus or large office networks.
- /24: 254 usable hosts. Most common for small office or home networks (Class C equivalent).
- /28: 14 usable hosts. Common for small network segments or management networks.
- /30: 2 usable hosts. Used for point-to-point links between routers.
- /31: 2 addresses, no reserved network/broadcast (RFC 3021). Used for point-to-point links.
- /32: 1 address. Host route or loopback.
Subnet CIDR calculator: frequently asked questions
How many hosts fit in a /24 subnet?
A /24 subnet has 32 - 24 = 8 host bits, giving 2^8 = 256 addresses. Two are reserved (network address and broadcast address), leaving 254 usable host addresses.
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation appends the prefix length to the IP address, such as 192.168.1.0/24. The prefix length specifies how many of the 32 bits are the network portion. CIDR replaced the old class-based system (Class A /8, Class B /16, Class C /24) with flexible subnetting.
Why are 2 addresses reserved in every subnet?
The first address (all host bits zero) is the network address, identifying the subnet itself. The last address (all host bits one) is the broadcast address, used to send to all hosts on the subnet. These cannot be assigned to individual hosts, so usable hosts = 2^(32-prefix) - 2.
What is a /32 subnet?
A /32 subnet has no host bits; it contains exactly one IP address. It is used for host routes (a route to a single specific host) and loopback addresses. There are no usable hosts in the traditional sense; the single address is both the host and the network.
What is the difference between a subnet mask and a prefix length?
A subnet mask is a 32-bit number with all 1s in the network portion and all 0s in the host portion. For /24, the mask is 255.255.255.0. CIDR prefix length is the count of leading 1 bits. They convey the same information in different notations.
Official sources
- IETF RFC 4632 Classless Inter-domain Routing (CIDR): rfc-editor.org/rfc/rfc4632.
- IANA IPv4 Address Space Registry: iana.org.
Reviewed by the CalculatorHub team, edited by James Graham, 15 June 2026. See our methodology.