Tip: pasting a full block like 192.168.1.0/24 into the IP field splits it automatically.
Free IPv4 CIDR and Subnet Calculator
The Tools Kit's free CIDR / Subnet Calculator turns an IPv4 address and prefix length into everything you need to plan or check a subnet: the network address, broadcast address, subnet mask, wildcard mask, first and last usable host, total addresses and usable host count. Use it as an IP subnet calculator, a CIDR to subnet mask converter, or a quick way to see how many hosts fit in a /24, /26 or /29.
The math is plain bitwise arithmetic that runs in your browser, so the addresses you enter are not sent to a server. It works with IPv4 only, for prefixes from /0 to /32.
How to Use the CIDR Calculator
- 1
Enter an IPv4 address
Type any IPv4 address in the block, such as 192.168.1.0, or paste a full CIDR block like 192.168.1.0/24 and it splits into the address and prefix fields automatically.
- 2
Set the CIDR prefix
Enter the prefix length as a whole number from 0 to 32, for example 24 for a /24 network or 26 for a /26.
- 3
Calculate
Click Calculate or press Enter. The address does not have to be the network address; the calculator masks off the host bits for you.
- 4
Read and copy the results
See the network and broadcast addresses, subnet mask, wildcard mask, first and last usable host, total addresses, usable hosts and the binary netmask, then use Copy all to copy the eight result rows (everything except the binary netmask) as text.
An address with an octet above 255 or a prefix outside 0 to 32 is rejected with an error message instead of producing a misleading result.
How CIDR Subnet Calculation Works
An IPv4 address is 32 bits. In CIDR notation the number after the slash says how many of those bits belong to the network; the rest identify hosts. A /24 keeps 24 network bits and leaves 8 host bits, so it contains 28 = 256 addresses. If you want to see the bits themselves, the binary converter turns each octet into its 8-bit form.
- Subnet mask = prefix-length 1 bits followed by 0 bits (/26 = 255.255.255.192)
- Network address = IP address AND subnet mask
- Broadcast address = network address OR wildcard mask
- Total addresses = 2(32 − prefix)
- Usable hosts = total − 2 (for /0 to /30)
Worked example: for 192.168.1.130/26 the mask is 255.255.255.192, so the last octet 130 (10000010 in binary) ANDed with 192 (11000000) gives 128. The network address is 192.168.1.128, the broadcast address is 192.168.1.191, and the 62 usable hosts run from 192.168.1.129 to 192.168.1.190.
Second example: 172.16.5.4/20 has the mask 255.255.240.0 and belongs to the network 172.16.0.0. Its broadcast address is 172.16.15.255, giving 4,096 total addresses and 4,094 usable hosts from 172.16.0.1 to 172.16.15.254.
CIDR to Subnet Mask Cheat Sheet
Common prefix lengths with their subnet masks and host counts, as the calculator reports them. Each step down in prefix length doubles the number of addresses.
| Prefix | Subnet mask | Total addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2 |
| /32 | 255.255.255.255 | 1 | 1 |
/31 and /32: The Special Cases
The usual rule of subtracting two reserved addresses breaks down at the smallest block sizes. A /31 has only two addresses, and point-to-point links between routers use both of them (RFC 3021), so the calculator reports 2 usable hosts with the first host equal to the network address and the last equal to the broadcast address. A /32 describes one single address, often used for a loopback interface or a host route, and is reported as 1 usable host. A /30, with 4 addresses and 2 usable hosts, is the smallest block that keeps separate network and broadcast addresses.
Common uses
- Planning IP address allocation for a home lab, office LAN or VLAN
- Checking how many devices a cloud VPC or subnet CIDR block can hold
- Working out the wildcard mask for a router ACL or OSPF network statement
- Verifying the usable host range before configuring a firewall, DHCP scope or static IPs
- Studying for networking certifications and checking subnetting practice answers
Subnetting often sits next to other network checks. Find the public address your network uses with the IP checker, map an address in your range back to its hostname with a reverse DNS lookup, or test which services a host exposes with the port scanner. If a public IP in your block is having mail delivery problems, the blacklist checker shows whether it is listed, and the MAC address lookup helps identify an unknown device you found on the subnet. More network and security utilities are collected on the security tools page.
Subnetting terms explained
| Term | What it means here |
|---|---|
| CIDR notation | An IP address followed by a slash and a prefix length, such as 192.168.1.0/24, that describes a block of addresses |
| Prefix length | The number of leading bits (0 to 32 in IPv4) that identify the network; the remaining bits identify hosts |
| Subnet mask | The prefix written as a dotted-decimal address, such as 255.255.255.0 for /24 |
| Wildcard mask | The inverse of the subnet mask, such as 0.0.0.255 for /24, used in router ACLs and OSPF statements |
| Network address | The first address in the block, with all host bits set to 0; it identifies the subnet itself |
| Broadcast address | The last address in the block, with all host bits set to 1; packets sent to it reach every host on the subnet |
| Usable host range | The addresses between the network and broadcast addresses that can be assigned to devices |
| Private range (RFC 1918) | 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, reserved for internal networks and not routed on the public internet |
Frequently Asked Questions
Enter the IPv4 address and the prefix length, or paste a block like 192.168.1.0/24 into the address field, and click Calculate. The calculator converts the prefix to a subnet mask, ANDs it with the address to find the network address, sets every host bit to 1 for the broadcast address, and lists the usable host range in between.
A /24 has 2 to the power of 8, or 256 addresses. The network address and the broadcast address are reserved, which leaves 254 usable hosts. For 192.168.1.0/24 the usable range is 192.168.1.1 to 192.168.1.254.
A /26 has 2 to the power of (32 - 26), which is 64 addresses, and 62 usable hosts after the network and broadcast addresses are removed. Its subnet mask is 255.255.255.192.
Total addresses = 2^(32 - prefix). Usable hosts = 2^(32 - prefix) - 2 for prefixes from /0 to /30. The calculator treats /31 and /32 as special cases: a /31 has 2 usable addresses and a /32 has 1.
Write the prefix as that many 1 bits followed by 0 bits to make 32 bits, then convert each group of 8 bits to decimal. /24 is 11111111.11111111.11111111.00000000, which is 255.255.255.0; /20 is 255.255.240.0. The calculator shows both the dotted-decimal mask and the binary netmask.
A wildcard mask is the bitwise inverse of the subnet mask: every 1 becomes 0 and every 0 becomes 1. For a /24 the subnet mask is 255.255.255.0 and the wildcard mask is 0.0.0.255. Cisco ACLs and OSPF network statements use wildcard masks.
Yes. Enter any address in the block and the calculator works out which subnet it belongs to. For example, 192.168.1.130/26 belongs to the network 192.168.1.128, with a broadcast address of 192.168.1.191 and usable hosts from 192.168.1.129 to 192.168.1.190.
A /31 has only two addresses, so reserving a network and a broadcast address would leave none. Point-to-point links use both addresses for the two ends of the link, as described in RFC 3021, so the calculator reports both as usable. A /32 is a single host address.
Private IPv4 addresses fall in 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16 (RFC 1918). When the address you enter is inside one of those ranges, the calculator labels the result as a private range. Other special ranges, such as 100.64.0.0/10 carrier-grade NAT space, are not flagged.
No. The CIDR / Subnet Calculator works with IPv4 addresses and prefix lengths from /0 to /32 only. It does not accept IPv6 addresses.
No. The subnet math is plain bitwise arithmetic that runs in your browser, so the addresses you enter are not sent anywhere to be calculated.
Reviewed by Raja Jahangir · Last reviewed: October 2026
How do you calculate a subnet from CIDR notation?
To calculate a subnet, enter an IPv4 address and a prefix length from 0 to 32, or paste a block like 192.168.1.0/24. The result shows the network address, broadcast address, subnet mask, wildcard mask, first and last usable host, and total addresses. A /24 holds 256 addresses, of which 254 are usable hosts.
How many usable hosts are in a /26 subnet?
A /26 subnet has 2 to the power of (32 minus 26), which is 64 addresses. Subtracting the network address and the broadcast address leaves 62 usable hosts, with a subnet mask of 255.255.255.192. For /31 and /32 blocks nothing is reserved, so a /31 point-to-point link has two usable addresses.
Runs in your browser. Your files and text never leave your device - nothing is uploaded.
