Skip to content
FiftyCalc Free calculators for all 50 states

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

Sample figures

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.

IP Subnet Calculator

IP address: first octet: enter a number from 0 to 255. Prefilled example: 192.

Second octet: enter a number from 0 to 255. Prefilled example: 168.

Third octet: enter a number from 0 to 255. Prefilled example: 1.

Fourth octet: enter a number from 0 to 255. Prefilled example: 130.

Prefix length (the /n in CIDR, 0-32): enter a number from 0 to 32. Prefilled example: 26.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. IP address: first octet: enter a number from 0 to 255.
  2. Second octet: enter a number from 0 to 255.
  3. Third octet: enter a number from 0 to 255.
  4. Fourth octet: enter a number from 0 to 255.
  5. Prefix length (the /n in CIDR, 0-32): enter a number from 0 to 32.
  6. 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

  1. Tot=232−p
  2. Use={1if p=322if p=31Tot−2otherwise
Symbols used in the formula
SymbolMeaning
pPrefix length (the /n in CIDR, 0-32)
TotAddresses in the subnet
UseUsable host addresses

Worked example

IP address: first octet192
Second octet168
Third octet1
Fourth octet130
Prefix length (the /n in CIDR, 0-32)26
Subnet mask, octet 1255
Network address, octet 1192
Broadcast address, octet 1192
Subnet mask, octet 2255
Network address, octet 2168
Broadcast address, octet 2168
Subnet mask, octet 3255
Network address, octet 31
Broadcast address, octet 31
Subnet mask, octet 4192
Network address, octet 4128
Broadcast address, octet 4191
Addresses in the subnet64
  1. Tot=232−26=64
  2. Use=64−2=62

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.

Related calculators