Quick Answer
A subnet is found by ANDing the IP address with the subnet mask. For 192.168.1.130/26, the mask is 255.255.255.192, the network is 192.168.1.128, the broadcast is 192.168.1.191, and the usable hosts are 192.168.1.129 to 192.168.1.190, which is 62 hosts.
Embed this calculator
Adjust the size if needed, then copy the code below into your page or blog. The calculator will load in an iframe and stay updated automatically.
Table of Contents
- Subnet Calculator
- Quick Answer
- Related Calculators
- How This Subnet Calculator Works
- How to Use the Subnet Calculator
- Core Formulas
- Key Terms
- Worked Example
- Real-Life Examples
- Subnet Mask vs Wildcard Mask
- Subnet Mask Cheat Sheet
- Tips for Subnetting
- Common Mistakes to Avoid
- Frequently Asked Questions
- References & Sources
How This Subnet Calculator Works
Enter an IPv4 address and choose a prefix length, or type the address in CIDR form such as 10.0.5.20/22. The calculator turns the address and mask into 32-bit numbers, keeps the network bits with a binary AND, and sets all host bits to 1 for the broadcast address. It then lists the usable host range, host count, wildcard mask, address type and a binary view.
Quick explanation: the prefix says how many of the 32 bits are the network part.
- /24: 255.255.255.0, 256 addresses, 254 usable.
- Network address: all host bits 0.
- Broadcast address: all host bits 1.
How to Use the Subnet Calculator
- Enter an IPv4 address, or an address with /prefix.
- Choose the prefix length or subnet mask.
- Press Calculate.
- Read the network, broadcast and usable host range.
- Check the binary view to see the network and host bits.
Core Formulas
- Network: IP AND mask
- Broadcast: network OR (NOT mask)
- Total addresses: 2(32 − prefix)
- Usable hosts: 2(32 − prefix) − 2, for prefixes up to /30
- Wildcard mask: 255.255.255.255 − subnet mask
Key Terms
- Subnet: a smaller network made by splitting a larger IP range.
- CIDR: Classless Inter-Domain Routing, the /prefix way of writing a network.
- Subnet mask: a 32-bit number with 1s for the network part of an address.
- Broadcast address: the last address in a subnet, used to reach all hosts.
- Usable host: an address that can be given to a device.
Worked Example
Find the subnet for 10.0.5.20/22.
- Mask: /22 = 255.255.252.0, so the third octet steps by 4
- 5 falls in the block 4–7, so the network is 10.0.4.0 and the broadcast is 10.0.7.255
- Usable hosts: 10.0.4.1 to 10.0.7.254, which is 1,022 hosts
Real-Life Examples
- Home networks: 192.168.1.0/24 gives 254 devices.
- Office VLANs: split a /24 into four /26 subnets of 62 hosts each.
- Cloud networks: plan VPC and subnet CIDR blocks without overlaps.
- Firewall rules: wildcard masks, such as 0.0.0.63 for /26, are used in many access lists.
Subnet Mask vs Wildcard Mask
- Subnet mask: 1s for network bits, such as 255.255.255.0.
- Wildcard mask: the opposite, 1s for host bits, such as 0.0.0.255.
- Use: masks set up interfaces, while wildcard masks are used in many router access lists and routing settings.
Subnet Mask Cheat Sheet
| CIDR | Subnet mask | Total addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /12 | 255.240.0.0 | 1,048,576 | 1,048,574 |
| /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 |
| /23 | 255.255.254.0 | 512 | 510 |
| /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 |
Tips for Subnetting
- Block size: 256 minus the interesting mask octet, such as 256 − 192 = 64 for /26.
- Private ranges: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 are for internal networks.
- Point-to-point links: /31 gives two usable addresses with no broadcast.
- Plan for growth: leave spare addresses in each subnet.
To check a subnet in your head, find the octet where the mask is not 255 or 0 and work out the block size. For /26, the last octet of the mask is 192, so the block size is 64 and subnets start at 0, 64, 128 and 192. An address ending in .130 falls in the block that starts at 128, so its network is .128 and its broadcast is .191, one less than the next block.
Common Mistakes to Avoid
- Using the network or broadcast address for a device. They are not usable for hosts in normal subnets.
- Forgetting the −2. A /24 has 256 addresses but 254 usable hosts.
- Overlapping subnets. 10.0.0.0/23 already includes 10.0.1.0/24.
- Mixing up mask and wildcard. 255.255.255.0 and 0.0.0.255 are opposites.
- Picking subnets too small. Leave room for growth.
Frequently Asked Questions
AND the IP address with the subnet mask to get the network address, then set the host bits to 1 for the broadcast.
256 addresses and 254 usable hosts.
255.255.255.192, with 64 addresses and 62 usable hosts.
30 network bits, mask 255.255.255.252, 4 addresses and 2 usable hosts.
RFC 3021 lets /31 subnets be used for point-to-point links with no network or broadcast address.
The inverse of the subnet mask, used in many router and firewall rules.
10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, defined in RFC 1918.
Yes. Type 192.168.1.130/26 and the prefix is read automatically.
No. It supports IPv4 only.
The first address in the subnet, with all host bits set to 0.
An older system (A, B, C) based on the first octet. CIDR replaced it, but the class is shown for reference.
Add bits to the prefix. Each extra bit doubles the number of subnets and halves their size.
References & Sources
| Source | Used For | Link |
|---|---|---|
| IETF, RFC 4632: Classless Inter-domain Routing (CIDR) | The CIDR addressing and prefix notation standard. | https://www.rfc-editor.org/rfc/rfc4632 |
| IETF, RFC 1918: Address Allocation for Private Internets | The private IPv4 address ranges. | https://www.rfc-editor.org/rfc/rfc1918 |
| IETF, RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links | Why /31 subnets have two usable addresses. | https://www.rfc-editor.org/rfc/rfc3021 |