CIDR Subnet Calculator
Enter an IPv4 or IPv6 address with a prefix, such as 192.0.2.42/26. Select Calculate subnet to see the network, mask for IPv4, and address range.
Results
How to calculate a subnet
Use the network address and range to check whether an address belongs to a subnet or to document a network allocation. The prefix length gives the number of network bits. The remaining bits determine the size of the block.
For example, 192.0.2.42/26 is in 192.0.2.0/26. Its subnet mask is 255.255.255.192 and its 64 addresses run from 192.0.2.0 to 192.0.2.63.
For IPv6, enter 2001:db8:12:34::42/64 to find its network prefix, 2001:db8:12:34::/64. The range starts at 2001:db8:12:34:: and ends at 2001:db8:12:34:ffff:ffff:ffff:ffff, for a total of 18,446,744,073,709,551,616 addresses.
| Prefix | Total addresses |
|---|---|
/24 | 256 |
/25 | 128 |
/26 | 64 |
/27 | 32 |
/28 | 16 |
/29 | 8 |
/30 | 4 |
Frequently asked questions
How do total addresses and usable hosts differ?
The total includes every address in the block. On ordinary IPv4 subnets, the network and broadcast addresses are reserved, so the usable host count excludes both. A /31 point-to-point link uses both addresses as endpoints, and a /32 represents a single host. Neither has a subnet broadcast address.
Why is there no dotted mask for IPv6?
IPv6 networks use the prefix length to show the network boundary. For example, 2001:db8::/64 uses the first 64 bits as the network prefix.
For location and network details in your application, see the IPWho geolocation API.
Add IP geolocation data to your application
Use IPWho’s IP geolocation API when your application needs the user’s location, network, company, currency and more.
- Under 50 ms global median response time
- Competitive pricing
- Free tier includes 2,000 lookups per day