Understanding IPv4 Addressing and Subnetting
An Internet Protocol version 4 (IPv4) address is a 32-bit numerical label assigned to each device participating in a computer network. These 32 bits are divided into two parts: the network portion, which identifies the specific network, and the host portion, which identifies the specific device on that network.
Subnetting is the practice of dividing a single physical network into smaller, logical sub-networks. This division is defined by a subnet mask, which determines where the network portion of the address ends and the host portion begins.
The Role of Subnet Masks and CIDR
A subnet mask is a 32-bit value typically written in dotted-decimal notation, such as 255.255.255.0. The mask uses consecutive binary 1s to represent the network portion and consecutive binary 0s to represent the host portion. If the input mask is not contiguous, the tool will display "That subnet mask is not contiguous.".
Classless Inter-Domain Routing (CIDR) is an alternative notation that simplifies this representation. Instead of writing out four octets, CIDR uses a slash followed by the number of network bits (the prefix length), such as /24. CIDR prefixes must be between /0 and /32.
Calculating Network Boundaries and Host Ranges
To manage a network, administrators must calculate several key boundaries from an IP address and a subnet mask:
- Network address: The first address in the subnet, which identifies the network itself. It is calculated by performing a bitwise AND operation between the IP address and the subnet mask.
- Broadcast address: The last address in the subnet, used to send data to all hosts on that network. It is calculated by taking the network address and setting all host bits to binary 1s.
- Usable hosts: The range of IP addresses that can be assigned to physical devices. Typically, this excludes the network address and the broadcast address, meaning the number of usable hosts is calculated as 2^(host bits) − 2.
Host Bits and Subnet Size
The number of host bits determines the total capacity of a subnet. The relationship between host bits and subnet size is direct: if a subnet has h host bits, the total number of addresses is 2^h. For example, a /24 network has 8 host bits, resulting in 2⁸ = 256 total addresses and 254 usable hosts.
Binary Representation and Wildcard Masks
At the hardware level, routers process IP addresses and subnet masks as binary data. Understanding the binary representation of a network address helps clarify how routers mask and route packets.
A wildcard mask is the inverse of a subnet mask. It is calculated by subtracting each octet of the subnet mask from 255 (for example, a subnet mask of 255.255.255.0 has a wildcard mask of 0.0.0.255). Wildcard masks are primarily used in Access Control Lists (ACLs) and routing protocols to specify which bits of an IP address must match for an action to occur.
Special Considerations for /31 and /32 Subnets
Standard subnetting rules change when dealing with extremely small subnets:
- /31 Networks: These subnets have only 1 host bit, yielding 2 total addresses. Because they are commonly used for point-to-point links where broadcast traffic is unnecessary, both addresses are usable. For these networks, the "Usable hosts" output will show the number of hosts followed by "(point-to-point)", for example,
2 (point-to-point). - /32 Networks: These subnets have 0 host bits, representing a single host route. The "Usable hosts" output will show the number of hosts followed by "(single host)", for example,
1 (single host). - Single Usable IP: If only one IP address is in the usable range, the "First usable" and "Last usable" outputs will display the IP address followed by "only", for example,
192.168.1.10 only.
Public vs. Private IP Addresses
While this tool calculates network boundaries for any valid IPv4 address, it does not identify whether an address is public or private.
Private IP addresses (defined in RFC 1918) are reserved for internal networks and are not routable on the global Internet. Public IP addresses are globally unique and routed across the public Internet. Whether an address is routed publicly depends entirely on the network configuration and routing tables of the systems it belongs to, rather than its mathematical subnet boundaries.
How to Use the Calculator
The IPv4 Subnet Calculator processes inputs locally to generate network details.
Input Requirements
- IP address: Enter an IPv4 address, such as
192.168.1.10. You can also enter an IP with an embedded CIDR prefix, like192.168.1.10/24. - CIDR or mask: Enter a CIDR prefix (e.g.,
/24or24) or a dotted subnet mask (e.g.,255.255.255.0).
Input Validation and Errors
- If the IP address input is empty, the tool displays:
Enter an IPv4 address. - If the IP address format is invalid, the tool displays:
Enter a valid IPv4 address such as 192.168.1.10. - If the CIDR or mask input is empty, the tool displays:
Enter a CIDR prefix or subnet mask. - If the CIDR or mask format is invalid, the tool displays:
Enter a mask such as /24 or 255.255.255.0.
Interface Controls
- Sample: Loads a sample IP and mask, updating the status to
Sample loaded. - Clear: Resets all inputs and outputs, updating the status to
Cleared. - Copying: Clicking on any calculated value copies it directly to your clipboard.
Local Processing and Privacy
Your IP and mask are calculated in your browser. Nothing is uploaded to BroBroGo.
Frequently Asked Questions
Can I enter CIDR or a dotted subnet mask?
Yes. Use /24, 24, or a dotted mask such as 255.255.255.0. The calculator also accepts an IP written as 192.168.1.10/24.
Why do /31 and /32 show unusual usable counts?
/31 networks are commonly used for point-to-point links, where both addresses can be usable. /32 represents a single host route, so the one address is shown as usable.
Does this tell me if an address is public or private?
No. This tool focuses on subnet boundaries: network, broadcast, range and counts. Whether an address is routed publicly depends on the network it belongs to.