The CIDR Calculator is designed to compute and analyze CIDR (Classless Inter-Domain Routing) information for IPv4 network addresses. It calculates network parameters including network address, broadcast address, subnet mask, and available host count based on CIDR notation, suitable for network planning, subnetting, and network troubleshooting.
What is CIDR
CIDR (Classless Inter-Domain Routing) is an IP address allocation and routing method that uses slash notation to indicate network prefix length.
CIDR notation format: IP Address/Prefix Length
Example: 192.168.1.0/24 indicates a network address of 192.168.1.0 with a 24-bit prefix length, meaning the subnet mask is 255.255.255.0.
Key Features
The tool supports input of any valid IPv4 CIDR notation and calculates detailed network parameter information in real-time. Quick example buttons are provided for convenient experimentation with calculation results for different network sizes.
All calculations are completed locally in the browser without requiring a network connection, protecting your network configuration privacy.
Usage Instructions
- Enter CIDR notation in the input box (e.g., 192.168.1.0/24)
- Press Enter or wait for automatic calculation
- View detailed network parameter results
- Or click quick example buttons to experience preset configurations
Calculation Results Explained
Network Address
The starting IP address of the subnet, used to identify the entire network. All host bits in the network address are 0.
Example: The network address for 192.168.1.0/24 is 192.168.1.0
Broadcast Address
The last IP address of the subnet, used to send data to all hosts in the network. All host bits in the broadcast address are 1.
Example: The broadcast address for 192.168.1.0/24 is 192.168.1.255
Subnet Mask
A 32-bit binary number used to distinguish network bits from host bits, where network bits are 1 and host bits are 0.
Example: The subnet mask corresponding to /24 is 255.255.255.0
Wildcard Mask
The inverse of the subnet mask, commonly used in ACL (Access Control List) configuration.
Example: The wildcard mask for 255.255.255.0 is 0.0.0.255
First Usable IP
The first IP address in the subnet that can be assigned to a host, typically the network address plus 1.
Example: The first usable IP for 192.168.1.0/24 is 192.168.1.1
Special case: For /31 and /32 networks, the first usable IP equals the network address
Last Usable IP
The last IP address in the subnet that can be assigned to a host, typically the broadcast address minus 1.
Example: The last usable IP for 192.168.1.0/24 is 192.168.1.254
Special case: For /31 and /32 networks, the last usable IP equals the broadcast address
Total Hosts
The total number of IP addresses the subnet can contain, including network and broadcast addresses.
Calculation formula: 2^(32 - prefix length)
Example: A /24 network has 2^8 = 256 total hosts
Usable Hosts
The number of IP addresses actually assignable to hosts in the subnet, excluding network and broadcast addresses.
Calculation formula: Total hosts - 2 (except for /31 and /32)
Example: A /24 network has 256 - 2 = 254 usable hosts
CIDR Bits
The network prefix length, indicating the number of consecutive 1s in the subnet mask.
Range: 0-32
Network Class
Traditional IP address classification method based on the first octet:
- Class A: 1-126, default subnet mask /8
- Class B: 128-191, default subnet mask /16
- Class C: 192-223, default subnet mask /24
- Class D: 224-239, multicast addresses
- Class E: 240-255, reserved addresses
Binary Subnet Mask
Binary representation of the subnet mask, intuitively showing network and host bits.
Example: The binary for 255.255.255.0 is 11111111.11111111.11111111.00000000
Quick Examples
The tool provides common network configuration examples:
- Class C Network (192.168.1.0/24): 254 usable hosts, suitable for small to medium LANs
- Class B Network (172.16.0.0/16): 65,534 usable hosts, suitable for large enterprise networks
- Class A Network (10.0.0.0/8): 16,777,214 usable hosts, suitable for very large networks
- Point-to-Point (192.168.1.0/30): 2 usable hosts, suitable for router interconnection
- Single Host (8.8.8.8/32): 1 host, used to specify a single device
Application Scenarios
Network Planning
When planning a new network, select an appropriate CIDR prefix length based on expected device count, calculate available IP address quantity to avoid waste or shortage.
Subnetting
Divide a large network into multiple smaller subnets, calculate the address range and usable host count for each subnet, and allocate IP resources rationally.
Firewall Configuration
When configuring firewall rules, use CIDR notation to define IP address ranges, calculate wildcard masks for ACL configuration.
Network Troubleshooting
When analyzing network configuration issues, verify whether IP addresses are in the correct subnet range and check if gateway and mask settings are correct.
Cloud Service Configuration
When configuring cloud servers and VPC (Virtual Private Cloud), plan subnet CIDR to ensure adequate and non-conflicting address space.
Usage Recommendations
Choosing Appropriate Prefix Length
Select prefix length based on actual needs, reserving some expansion space:
- /24 (254 hosts): Suitable for small to medium offices, departmental networks
- /23 (510 hosts): Suitable for large offices, small enterprises
- /22 (1,022 hosts): Suitable for medium enterprises
- /21 (2,046 hosts): Suitable for large enterprise branches
- /16 (65,534 hosts): Suitable for corporate headquarters, data centers
- /30 (2 hosts): Suitable for point-to-point connections
- /32 (1 host): Suitable for single devices, loopback addresses
Avoiding Address Waste
When selecting prefix length, choose smaller networks that meet requirements to avoid allocating too many unusable addresses.
Special Networks to Note
- /31 networks: Point-to-point networks defined by RFC 3021, with no network or broadcast address, both IPs are usable
- /32 networks: Single host networks, only 1 IP address
Important Notes
Tool calculation results are based on IPv4 standards and are not applicable to IPv6 addresses.
Some special IP address ranges (such as 0.0.0.0, 127.0.0.0, 224.0.0.0, etc.) have special purposes, requiring attention in actual use.
Private IP address ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) are for internal networks only and cannot be used directly on the public internet.
Calculation results are for reference only; actual network configuration must be combined with specific requirements of routers, switches, and other equipment.
Common Questions
Why does a /31 network have 2 usable hosts?
Traditional IP subnets need to reserve network and broadcast addresses, but RFC 3021 defines /31 networks for point-to-point connections, eliminating the need for these two reserved addresses, so both IPs are usable.
How to determine if two IPs are in the same subnet?
Calculate the network address for both IPs; if the network addresses are the same, they are in the same subnet. This tool helps quickly obtain the network address.
What is the difference between CIDR and subnet mask?
CIDR is a notation method using a slash and number to indicate network prefix length (e.g., /24); subnet mask is a specific 32-bit binary number (e.g., 255.255.255.0). They are essentially the same, just different representation forms.
Why are network and broadcast addresses needed?
Network address is used to identify the entire network, used by routers for routing decisions; broadcast address is used to send data to all hosts in the subnet simultaneously. These two addresses cannot be assigned to hosts in traditional subnets.
Does usable host count include the gateway?
The gateway is typically one of the usable IP addresses in the subnet (commonly the first or last usable IP) and is included in the usable host count. For example, a /24 network has 254 usable addresses, one used as the gateway, leaving 253 assignable to other devices.




