IP Subnet Calculator
Test cases replayed : 3 of 3 match · Methodology · No outside source listed
Type an IPv4 address and its prefix length (for example 192.168.1.130/26) to see the subnet it belongs to.
Result
Usable host addresses
Addresses in the subnet
- Subnet mask, octet 1
- Subnet mask, octet 2
- Subnet mask, octet 3
- Subnet mask, octet 4
- Network address, octet 1
- Network address, octet 2
- Network address, octet 3
- Network address, octet 4
- Broadcast address, octet 1
- Broadcast address, octet 2
- Broadcast address, octet 3
- Broadcast address, octet 4
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- IP address: first octet: enter a number from 0 to 255.
- Second octet: enter a number from 0 to 255.
- Third octet: enter a number from 0 to 255.
- Fourth octet: enter a number from 0 to 255.
- Prefix length (the /n in CIDR, 0-32): enter a number from 0 to 32.
- Read the result: Usable host addresses; the panel also shows Addresses in the subnet, Subnet mask, octet 1, Subnet mask, octet 2, Subnet mask, octet 3, Subnet mask, octet 4, Network address, octet 1, Network address, octet 2, Network address, octet 3, Network address, octet 4, Broadcast address, octet 1, Broadcast address, octet 2, Broadcast address, octet 3 and Broadcast address, octet 4.
How this calculator works
A /p prefix keeps the first p of the 32 address bits as the network part; the other 32 − p bits number the hosts, so the subnet holds 2^(32 − p) addresses.
In each octet, h = the number of host bits that fall in it (between 0 and 8). Mask octet = 256 − 2^h; network octet = the address octet rounded down to a multiple of 2^h; broadcast octet = network octet + 2^h − 1.
Usable hosts = 2^(32 − p) − 2, because the network and broadcast addresses are not assigned to hosts. A /31 is used for point-to-point links with both addresses usable (RFC 3021) and a /32 names a single host.
The formula
| Symbol | Meaning |
|---|---|
| Prefix length (the /n in CIDR, 0-32) | |
| Addresses in the subnet | |
| Usable host addresses |
Worked example
| IP address: first octet | 192 |
|---|---|
| Second octet | 168 |
| Third octet | 1 |
| Fourth octet | 130 |
| Prefix length (the /n in CIDR, 0-32) | 26 |
| Subnet mask, octet 1 | 255 |
|---|---|
| Network address, octet 1 | 192 |
| Broadcast address, octet 1 | 192 |
| Subnet mask, octet 2 | 255 |
| Network address, octet 2 | 168 |
| Broadcast address, octet 2 | 168 |
| Subnet mask, octet 3 | 255 |
| Network address, octet 3 | 1 |
| Broadcast address, octet 3 | 1 |
| Subnet mask, octet 4 | 192 |
| Network address, octet 4 | 128 |
| Broadcast address, octet 4 | 191 |
| Addresses in the subnet | 64 |
Usable host addresses 62
Each step uses the unrounded value of the step before it; figures on this page are rounded for display.
Frequently asked questions
How many hosts are in a /26?
64 addresses, of which 62 are usable hosts.
What is the network of 192.168.1.130/26?
192.168.1.128, with mask 255.255.255.192 and broadcast 192.168.1.191.
How many usable hosts does a /24 have?
254: 256 addresses minus the network and broadcast addresses.