CIDR Calculator
Enter an IP address with CIDR prefix to calculate network range, subnet mask, and host count.
Common CIDR Blocks
Click any block to load it into the calculator:
10.0.0.0/8
Class A private — 16.7M hosts
172.16.0.0/12
Class B private — 1M hosts
192.168.0.0/16
Class C private — 65K hosts
192.168.1.0/24
Typical home/office — 254 hosts
10.0.0.0/30
Point-to-point link — 2 hosts
0.0.0.0/0
Default route — all addresses
CIDR Prefix Reference Table
Complete mapping of CIDR prefixes to subnet masks and host counts:
| CIDR | Subnet Mask | Total IPs | Usable Hosts | Common Use |
|---|---|---|---|---|
/32 |
255.255.255.255 | 1 | 1 | Single host |
/31 |
255.255.255.254 | 2 | 2* | Point-to-point (RFC 3021) |
/30 |
255.255.255.252 | 4 | 2 | Point-to-point links |
/29 |
255.255.255.248 | 8 | 6 | Small network segment |
/28 |
255.255.255.240 | 16 | 14 | Small office |
/27 |
255.255.255.224 | 32 | 30 | Department network |
/26 |
255.255.255.192 | 64 | 62 | Medium subnet |
/25 |
255.255.255.128 | 128 | 126 | Half a /24 |
/24 |
255.255.255.0 | 256 | 254 | Standard LAN (Class C) |
/23 |
255.255.254.0 | 512 | 510 | Two /24 blocks |
/22 |
255.255.252.0 | 1,024 | 1,022 | Four /24 blocks |
/20 |
255.255.240.0 | 4,096 | 4,094 | Large campus |
/16 |
255.255.0.0 | 65,536 | 65,534 | Enterprise (Class B) |
/8 |
255.0.0.0 | 16,777,216 | 16,777,214 | ISP / Cloud (Class A) |
*RFC 3021 allows /31 for point-to-point links with no broadcast address
What is CIDR Notation?
CIDR (Classless Inter-Domain Routing) notation is a compact way to specify IP address ranges. It combines an IP address with a prefix length that indicates how many leading bits define the network.
Example: 192.168.1.0/24
IP Address: 192.168.1.0 Prefix: /24 (24 bits for network) Subnet Mask: 255.255.255.0 Network Bits: 192.168.1 (first 24 bits, fixed) Host Bits: .0 to .255 (last 8 bits, variable) Usable Range: 192.168.1.1 – 192.168.1.254 Total Hosts: 256 addresses, 254 usable
How CIDR Works
The prefix number (0–32) specifies how many bits are used for the network portion. The remaining bits identify individual hosts within that network.
- Larger prefix (e.g., /28): Smaller network, fewer hosts
- Smaller prefix (e.g., /16): Larger network, more hosts
- /32: Single IP address (host route)
- /0: All IP addresses (default route)
Why CIDR Replaced Classful Addressing
Before CIDR, IP addresses were divided into fixed classes (A, B, C) with rigid boundaries. Class C (/24) had only 254 hosts, while Class B (/16) had 65,534—nothing in between. CIDR allows any prefix length, enabling efficient allocation. An organization needing 1,000 addresses can get a /22 instead of wasting a full /16.
Calculating Hosts and Subnets
Usable Hosts Formula
To calculate usable hosts from a CIDR prefix:
Usable Hosts = 2^(32 - prefix) - 2 Example /24: 2^(32-24) - 2 = 2^8 - 2 = 256 - 2 = 254 usable hosts Example /27: 2^(32-27) - 2 = 2^5 - 2 = 32 - 2 = 30 usable hosts Example /30: 2^(32-30) - 2 = 2^2 - 2 = 4 - 2 = 2 usable hosts
You subtract 2 because every subnet reserves the first address (network address) and last address (broadcast address).
Network and Broadcast Addresses
- Network Address: The first address in the range. All host bits are 0. Identifies the subnet itself.
- Broadcast Address: The last address in the range. All host bits are 1. Used to send to all hosts on the subnet.
- Usable Range: Everything between the network and broadcast addresses.
Subnet Mask Conversion
The subnet mask is a 32-bit number with 1s for network bits and 0s for host bits:
/24 in binary: 11111111.11111111.11111111.00000000 /24 in decimal: 255.255.255.0 /20 in binary: 11111111.11111111.11110000.00000000 /20 in decimal: 255.255.240.0 /30 in binary: 11111111.11111111.11111111.11111100 /30 in decimal: 255.255.255.252
Private vs Public IP Ranges
RFC 1918 defines three private IP ranges that are not routed on the public internet. Use these for internal networks:
| CIDR Block | Range | Total IPs | Typical Use |
|---|---|---|---|
10.0.0.0/8 |
10.0.0.0 – 10.255.255.255 | 16,777,216 | Large enterprises, cloud VPCs |
172.16.0.0/12 |
172.16.0.0 – 172.31.255.255 | 1,048,576 | Medium enterprises |
192.168.0.0/16 |
192.168.0.0 – 192.168.255.255 | 65,536 | Home and small office networks |
Special addresses: 127.0.0.0/8 is reserved for loopback (localhost). 169.254.0.0/16 is link-local (APIPA) when DHCP fails.
Frequently Asked Questions
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation is a compact way to represent IP address ranges. It combines an IP address with a prefix length (e.g., 192.168.1.0/24). The number after the slash indicates how many bits define the network portion, with remaining bits available for host addresses.
How do I calculate usable hosts from CIDR?
Usable hosts = 2^(32 - prefix) - 2. You subtract 2 because the first address is the network address and the last is the broadcast address. For example, /24 gives 2^8 - 2 = 254 usable hosts. /30 gives 2^2 - 2 = 2 usable hosts (common for point-to-point links).
What is the difference between /24 and /16?
/24 uses 24 bits for the network, leaving 8 bits for hosts (254 usable addresses). /16 uses 16 bits for the network, leaving 16 bits for hosts (65,534 usable addresses). A /16 is 256 times larger than a /24.
What CIDR should I use for a small office?
For small networks: /24 (254 hosts) is common for offices. /25 gives 126 hosts, /26 gives 62 hosts, /27 gives 30 hosts. Choose based on current devices plus 50-100% growth room. For home networks, /24 is typical.
What is a subnet mask?
A subnet mask is a 32-bit number that separates the network and host portions of an IP address. In dotted decimal, /24 equals 255.255.255.0, /16 equals 255.255.0.0, and /8 equals 255.0.0.0. Routers use subnet masks to determine if traffic stays local or needs forwarding.
What is the broadcast address?
The broadcast address is the last address in a subnet, used to send packets to all hosts on that network. For 192.168.1.0/24, the broadcast is 192.168.1.255. You cannot assign the broadcast address to a device.
Can I use /31 subnets?
Yes. RFC 3021 allows /31 subnets for point-to-point links where broadcast isn't needed. Both addresses are usable since there's no network or broadcast address. This is common for router-to-router connections.
What does /0 mean?
/0 (0.0.0.0/0) represents all IP addresses—the entire IPv4 address space. It's used as the default route in routing tables, matching any destination when no more specific route exists.
How do I convert CIDR to IP range?
Use the CIDR calculator above. Enter your CIDR block (e.g., 10.0.0.0/22), and it shows the first usable IP, last usable IP, network address, and broadcast address. The range spans from network+1 to broadcast-1.
What private IP range should I use?
192.168.x.x/16 for home and small office. 10.x.x.x/8 for large enterprises or cloud environments (gives the most flexibility). 172.16.x.x/12 is less common but available. All three are non-routable on the public internet.
Privacy & Limitations
- All calculations run entirely in your browser -- nothing is sent to any server.
- Results are computed locally and should be verified for critical applications.
Related Tools
- SHA-256 Generator -- Generate SHA-256 hashes from text using Web Crypto API
- JSON to TypeScript Converter -- Generate TypeScript interfaces and types from JSON objects automatically
- Binary Text Decoder -- Convert binary to text and text to binary
- JWT Encoder -- Create and encode JWT tokens with custom claims
Related Tools
View all toolsBig-O Notation Visualizer
Interactive plot of O(1) through O(n!) complexity curves with operation count comparison
JSON Formatter
Format and beautify JSON with proper indentation
JSON Validator
Validate JSON syntax and show errors
CSV to JSON Converter
Convert CSV data to JSON format with auto-detection
JSON to CSV Converter
Convert JSON arrays to CSV format with nested object handling
JWT Decoder
Decode JWT tokens and display header and payload
CIDR Calculator FAQ
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation is a compact way to represent IP address ranges. It combines an IP address with a prefix length (e.g., 192.168.1.0/24). The number after the slash indicates how many bits define the network portion, with remaining bits available for host addresses.
How do I calculate usable hosts from CIDR?
Usable hosts = 2^(32 - prefix) - 2. You subtract 2 because the first address is the network address and the last is the broadcast address. For example, /24 gives 2^8 - 2 = 254 usable hosts. /30 gives 2^2 - 2 = 2 usable hosts (common for point-to-point links).
What is the difference between /24 and /16?
/24 uses 24 bits for the network, leaving 8 bits for hosts (254 usable addresses). /16 uses 16 bits for the network, leaving 16 bits for hosts (65,534 usable addresses). A /16 is 256 times larger than a /24.
What CIDR should I use for a small office?
For small networks: /24 (254 hosts) is common for offices. /25 gives 126 hosts, /26 gives 62 hosts, /27 gives 30 hosts. Choose based on current devices plus 50-100% growth room. For home networks, /24 is typical.
What is a subnet mask?
A subnet mask is a 32-bit number that separates the network and host portions of an IP address. In dotted decimal, /24 equals 255.255.255.0, /16 equals 255.255.0.0, and /8 equals 255.0.0.0. Routers use subnet masks to determine if traffic stays local or needs forwarding.
What is the broadcast address?
The broadcast address is the last address in a subnet, used to send packets to all hosts on that network. For 192.168.1.0/24, the broadcast is 192.168.1.255. You cannot assign the broadcast address to a device.