IP Subnet Calculator – CIDR, Network & Host Range
Network Address
—
Broadcast Address
—
First Usable Host
—
Last Usable Host
—
Usable Hosts
—
CIDR Notation
—
Subnet Mask
—
Wildcard Mask
—
Binary Representation (IP)
—
Binary Representation (Mask)
—
IP Class
—
How IP Subnetting Works
An IPv4 address is a 32-bit number written as four octets separated by dots (e.g., 192.168.1.100), uniquely identifying every device on an IP network. Each octet ranges from 0 to 255, giving roughly 4.3 billion possible addresses in total. Because networks vary enormously in size, the 32 bits are split into two portions: the network portion, which identifies the specific network segment, and the host portion, which identifies individual devices within that segment.
A subnet mask determines where the boundary falls between these two portions. The mask is also a 32-bit value, but it uses a contiguous run of 1-bits on the left (network) followed by 0-bits on the right (host). For example, the mask 255.255.255.0 has twenty-four 1-bits and eight 0-bits, meaning the first three octets identify the network and the last octet identifies hosts. By performing a bitwise AND between the IP address and the subnet mask, you obtain the network address. The broadcast address is found by setting all host bits to 1, and usable host addresses fall between the network address and the broadcast address.
Subnetting lets network administrators divide a single large network into smaller, more manageable segments. This improves security by isolating traffic between departments or floors, reduces broadcast domain size for better performance, and makes IP address management more organized. Without subnetting, every device in an organization would share one flat broadcast domain, resulting in congestion and security vulnerabilities.
CIDR Notation Explained
CIDR (Classless Inter-Domain Routing) is an IP addressing method, defined in RFC 4632, that replaced the older classful addressing system in 1993. Under the classful system, networks were rigidly divided into Class A (/8), Class B (/16), and Class C (/24), which led to massive address waste. A company needing 300 addresses would receive an entire Class B with 65,534 host addresses, wasting over 65,000 IPs.
CIDR notation appends a prefix length to the IP address, written as a slash followed by a number from 0 to 32. The number represents how many bits belong to the network portion. For example, /24 means 24 network bits and 8 host bits (256 addresses), /25 gives 128 addresses, and /26 gives 64 addresses. This flexibility allows administrators to allocate exactly the right number of addresses for each subnet, minimizing waste.
Common CIDR prefix lengths include /8 (16.7 million addresses, used by major ISPs), /16 (65,536 addresses, suitable for large campuses), /24 (256 addresses, the standard for small networks), /28 (16 addresses, ideal for small server groups), and /30 (4 addresses, 2 usable, used for point-to-point router links). The /32 prefix represents a single host address and is used in routing tables and loopback configurations.
Key IP Subnetting Terms
| Term | Definition |
|---|---|
| IP Address | A unique 32-bit (IPv4) or 128-bit (IPv6) numerical label assigned to each device on a network. Written in dotted-decimal format for IPv4 (e.g., 10.0.0.1). |
| Subnet Mask | A 32-bit value that separates the network portion from the host portion of an IP address. Uses contiguous 1-bits for the network and 0-bits for the host portion. |
| CIDR | Classless Inter-Domain Routing. A method of allocating IP addresses that replaces the old Class A/B/C system with variable-length prefixes, expressed as /n (e.g., /24). |
| Network Address | The first address in a subnet, obtained by setting all host bits to 0. It identifies the subnet itself and cannot be assigned to a device. |
| Broadcast Address | The last address in a subnet, obtained by setting all host bits to 1. Packets sent to this address are delivered to all hosts on the subnet. |
| Usable Hosts | The number of addresses available for devices, calculated as 2^(host bits) - 2. The two subtracted addresses are the network and broadcast addresses. |
| Wildcard Mask | The bitwise inverse of the subnet mask. Used in Cisco ACLs and OSPF configurations. For a /24 mask (255.255.255.0), the wildcard is 0.0.0.255. |
| VLSM | Variable Length Subnet Masking. The practice of using different prefix lengths within the same network to optimize IP address allocation for subnets of varying sizes. |
| Supernetting | The opposite of subnetting: combining multiple smaller networks into a larger aggregate. Also called route summarization, it reduces the size of routing tables. |
Common Subnet Masks Reference Table
The following table lists the most commonly used CIDR prefixes from /8 through /30, along with their dotted-decimal subnet mask, wildcard mask, total addresses, and usable host count. Use this as a quick reference when planning network segments.
| CIDR | Subnet Mask | Wildcard Mask | Total Addresses | Usable Hosts |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
Practical Subnetting Examples
Example 1: Splitting a /24 Into Four /26 Subnets
Suppose you have the network 192.168.10.0/24 and need to create four equal subnets for four departments. Moving from /24 to /26 borrows 2 additional bits from the host portion, creating 2^2 = 4 subnets, each with 64 addresses (62 usable).
| Subnet | Network Address | Usable Range | Broadcast |
|---|---|---|---|
| 1 | 192.168.10.0/26 | 192.168.10.1 - .62 | 192.168.10.63 |
| 2 | 192.168.10.64/26 | 192.168.10.65 - .126 | 192.168.10.127 |
| 3 | 192.168.10.128/26 | 192.168.10.129 - .190 | 192.168.10.191 |
| 4 | 192.168.10.192/26 | 192.168.10.193 - .254 | 192.168.10.255 |
Example 2: Planning a Small Office Network
A small office has 40 workstations, 5 printers, 3 servers, a router, and 2 access points. That is 51 devices. The smallest subnet that fits is a /26 with 62 usable addresses, leaving room for 11 future devices. If you chose a /27 (30 usable hosts), it would be too small. The network plan would look like this:
- Network: 10.0.1.0/26
- Gateway (router): 10.0.1.1
- Servers: 10.0.1.2 - 10.0.1.4
- Printers: 10.0.1.5 - 10.0.1.9
- Access points: 10.0.1.10 - 10.0.1.11
- Workstations: 10.0.1.12 - 10.0.1.51 (DHCP range)
- Spare: 10.0.1.52 - 10.0.1.62
- Broadcast: 10.0.1.63
If the office grows beyond 62 devices, you would need to move to a /25 (126 usable hosts) or add a second /26 subnet with a VLAN and inter-VLAN routing.
IPv4 vs IPv6 Overview
IPv4 has been the dominant Internet Protocol since the early 1980s, but its 32-bit address space (about 4.3 billion addresses) is now fully exhausted according to IANA. IPv6, specified in RFC 8200, was developed to solve this limitation with a vastly larger 128-bit address space, providing approximately 3.4 x 10^38 unique addresses -- enough to assign trillions of addresses to every person on Earth.
IPv6 addresses are written as eight groups of four hexadecimal digits separated by colons, such as 2001:0db8:85a3:0000:0000:8a2e:0370:7334. Leading zeros can be omitted, and consecutive groups of zeros can be replaced with :: (double colon) once per address. The standard subnet prefix for IPv6 is /64, which allocates 64 bits for the network and 64 bits for the host, giving each subnet 2^64 (about 18.4 quintillion) addresses.
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address Length | 32 bits | 128 bits |
| Address Format | Dotted decimal (192.168.1.1) | Hexadecimal colon (2001:db8::1) |
| Total Addresses | ~4.3 billion | ~3.4 x 10^38 |
| Standard Subnet | /24 (254 hosts) | /64 (~18.4 quintillion hosts) |
| NAT Required | Commonly used | Not needed (end-to-end) |
| Header Size | 20-60 bytes (variable) | 40 bytes (fixed) |
While this calculator focuses on IPv4 subnetting, the core concepts of dividing addresses into network and host portions apply equally to IPv6. Most modern networks run dual-stack configurations, supporting both IPv4 and IPv6 simultaneously during the transition period.
Frequently Asked Questions
How do I convert a subnet to an IP range?
To convert a subnet to an IP range, take the network address (all host bits set to 0) as the start and the broadcast address (all host bits set to 1) as the end. For example, 192.168.1.0/24 gives a range from 192.168.1.0 to 192.168.1.255, with usable host addresses from 192.168.1.1 to 192.168.1.254. Enter any IP and CIDR prefix into this calculator to see the full range instantly.
How many hosts are in a /24 subnet?
A /24 subnet has 256 total IP addresses (2^8). Two addresses are reserved: the network address (first, e.g., 192.168.1.0) and the broadcast address (last, e.g., 192.168.1.255). That leaves 254 usable host addresses (192.168.1.1 through 192.168.1.254). The /24 is the most common subnet size for small to medium office networks, home LANs, and VLAN segments.
What is the difference between CIDR notation and a subnet mask?
CIDR notation and subnet masks convey the same information in different formats. A subnet mask like 255.255.255.0 uses dotted-decimal format, while the equivalent CIDR notation /24 simply states the number of network bits. CIDR is more compact and is the modern standard used in routing protocols and documentation, while dotted-decimal subnet masks are still required in many device configuration interfaces (Windows, older routers).
What is VLSM and why is it important?
VLSM (Variable Length Subnet Masking) allows you to use different subnet mask lengths within the same network. Instead of giving every subnet the same size, VLSM lets you allocate a /28 (14 usable hosts) for a 10-device department and a /24 (254 usable hosts) for a 200-device floor. This conserves IP addresses, reduces routing table size through summarization, and makes network design far more efficient.
How do I convert an IP range back to CIDR notation?
Count the total number of addresses in the range and find the power of 2 that matches. Subtract that power from 32 to get the CIDR prefix. For example, a range of 256 addresses is 2^8, so the prefix is 32 - 8 = /24. The range must start on a network boundary (the first address must be evenly divisible by the block size) for a single CIDR block to cover it exactly. If the range does not align to a power of 2, you will need multiple CIDR blocks to represent it.
What is the difference between IPv4 and IPv6 subnetting?
IPv4 uses 32-bit addresses with subnet masks up to /32, while IPv6 uses 128-bit addresses with prefixes up to /128. IPv6 subnetting typically uses a /64 prefix for individual network segments, giving each subnet 2^64 (about 18.4 quintillion) addresses. IPv6 eliminates the need for NAT and simplifies address allocation. The core logic of dividing network and host portions remains the same, but the vastly larger address space means subnetting is primarily used for organizational hierarchy rather than conservation.