Data Source and Methodology
This tool's calculations are based on the foundational standards for IPv4 addressing and subnetting.
- Authoritative DataSource: IETF RFC 4632 (Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan).
- Reference: https://datatracker.ietf.org/doc/html/rfc4632
- Date: August 2006
All calculations are based strictly on the bitwise operations and standards defined in this RFC and related networking principles.
The Formulas Explained
CIDR calculations rely on bitwise logic. An IPv4 address is a 32-bit number. The CIDR mask (e.g., /24) defines how many bits are part of the network (the prefix) and how many are for hosts.
The core operations are:
$$ \text{Network Address} = \text{IP Address (long)} \text{ AND } \text{Subnet Mask (long)} $$
$$ \text{Wildcard Mask} = \text{NOT } \text{Subnet Mask} $$
$$ \text{Broadcast Address} = \text{Network Address (long)} \text{ OR } \text{Wildcard Mask (long)} $$
$$ \text{Total Hosts} = 2^{(32 - \text{CIDR Mask})} $$
$$ \text{Usable Hosts} = \text{Total Hosts} - 2 $$
Note: 'AND', 'OR', and 'NOT' are bitwise logical operations. 'long' refers to the 32-bit integer representation of the IP address.
Glossary of Variables
- IP/CIDR Notation (Input)
- The input format, e.g.,
192.168.1.1/24, combining an IP address with its network mask length. - Subnet Mask (Output)
- A 32-bit number that separates the network portion of an IP from the host portion. In
/24, the mask is255.255.255.0. - Wildcard Mask (Output)
- The bitwise inverse of the subnet mask. It's used in Access Control Lists (ACLs) to identify IP ranges. For
255.255.255.0, the wildcard is0.0.0.255. - Network Address (Output)
- The first IP address in the range. It is reserved and cannot be assigned to a device. It identifies the network itself.
- Broadcast Address (Output)
- The last IP address in the range. It is reserved for sending data to all hosts on the subnet simultaneously.
- First/Last Host IP (Output)
- The first and last IP addresses that can be assigned to devices (e.g., computers, phones) within the network.
- Total Hosts (Output)
- The total number of IP addresses in the subnet, including the network and broadcast addresses.
- Usable Hosts (Output)
- The number of IPs available to be assigned to devices. This is typically Total Hosts minus 2 (for the network and broadcast addresses).
How It Works: A Step-by-Step Example
Let's calculate the details for 192.168.10.50 /24.
- Identify Inputs:
- IP Address:
192.168.10.50 - CIDR Mask:
/24
- IP Address:
- Convert to Binary:
- IP:
11000000.10101000.00001010.00110010 - Subnet Mask (/24):
11111111.11111111.11111111.00000000(which is255.255.255.0)
- IP:
- Calculate Network Address (IP AND Mask):
11000000.10101000.00001010.00110010 (IP) & 11111111.11111111.11111111.00000000 (Mask) = 11000000.10101000.00001010.00000000
This binary value converts to
192.168.10.0. - Calculate Broadcast Address (Network OR (NOT Mask)):
- Wildcard (NOT Mask):
00000000.00000000.00000000.11111111(which is0.0.0.255)
11000000.10101000.00001010.00000000 (Network) | 00000000.00000000.00000000.11111111 (Wildcard) = 11000000.10101000.00001010.11111111
This binary value converts to
192.168.10.255. - Wildcard (NOT Mask):
- Calculate Hosts:
- Total: $ 2^{(32 - 24)} = 2^8 = 256 $
- Usable: $ 256 - 2 = 254 $
- Final Range:
- First Host:
192.168.10.1(Network + 1) - Last Host:
192.168.10.254(Broadcast - 1)
- First Host:
Frequently Asked Questions (FAQ)
What is CIDR (Classless Inter-Domain Routing)?
CIDR is a method for allocating IP addresses and routing Internet Protocol packets. It replaced the older 'classful' network system (Class A, B, C) to allow for more flexible allocation of IP address blocks. CIDR notation represents an IP address and its associated network mask, written as 'xxx.xxx.xxx.xxx/n', where 'n' is the number of '1' bits in the subnet mask.
Why is the Wildcard Mask useful?
The wildcard mask is the inverse of the subnet mask. It is primarily used in Access Control Lists (ACLs) on routers and firewalls. It tells the device which parts of an IP address to match. A '0' in the wildcard mask means 'match this octet exactly,' while a '255' means 'ignore this octet.'
What's the difference between Total Hosts and Usable Hosts?
Total Hosts is the total number of IP addresses within a subnet, calculated as $ 2^{(32-n)} $. Usable Hosts is the number of addresses that can be assigned to devices. This is typically Total Hosts minus 2, because the first IP is reserved for the Network Address and the last IP is reserved for the Broadcast Address.
What does a /32 mask mean?
A /32 mask (255.255.255.255) specifies a single, exact IP address. The network has only one IP, which is the host address itself. It has 1 total host and 0 usable hosts.
What does a /31 mask mean?
A /31 mask (255.255.255.254) is a special case often used for point-to-point links. It has 2 total hosts, which are used as the two endpoints of the link. It has 0 usable hosts in the traditional sense.
What does a /0 mask mean?
A /0 mask (0.0.0.0) represents the entire IPv4 internet. It matches all 4.3 billion addresses and is commonly used to define a default route.
Can I use this calculator for IPv6?
No, this calculator is designed specifically for IPv4 addresses and CIDR notation. IPv6 uses a different addressing system (128 bits) and notation.
Tool developed by Ugo Candido. Network engineering concepts verified by the CalcDomain Editorial Board.
Last accuracy review: