calculator.onl
Categories50

IPv4 subnet calculator

Find the network, mask, directed broadcast and host range from an IPv4 address and CIDR prefix.

A worked example

Keep the same IPv4 address and lengthen the prefix from /24 to /25. Find the new network boundary.

Network address192.168.1.0Subnet mask255.255.255.0Theoretical usable host addresses254Directed broadcast192.168.1.255
Octet 1: 0–255.

Octet 2: 0–255.

Octet 3: 0–255.

Octet 4: 0–255.

CIDR prefix length: 0–32. /31 assumes an RFC 3021 point-to-point link: both addresses identify endpoints, with no directed broadcast. /32 identifies a single host address; it has no directed broadcast.

Updates as you type

Use a dot or comma for decimals. No thousands separators.

YOUR RESULT

Network address

192.168.1.0

Calculated from your inputs

Subnet mask255.255.255.0
Directed broadcast192.168.1.255
First host address192.168.1.1
Theoretical usable host addresses254
The numbers, at a glance

Calculations run in your browser.
UNDERSTAND THE RESULT

A little context. A clearer answer.

↑ Back to calculator

When this calculator is useful

Changing the prefix moves the network boundary and can put the same address in a block with a different host range. For a related calculation, try Download and upload time calculator.

What to enter

InputWhat it meansExample value
Octet 1Octet 1: 0–255.192
Octet 2Octet 2: 0–255.168
Octet 3Octet 3: 0–255.1
Octet 4Octet 4: 0–255.42
CIDR prefix lengthCIDR prefix length: 0–32. /31 assumes an RFC 3021 point-to-point link: both addresses identify endpoints, with no directed broadcast. /32 identifies a single host address; it has no directed broadcast.24

How the calculation works

  1. Octet 1–4: 0–255.
  2. CIDR prefix length: /0–/32.
  3. Network address; Subnet mask; Host address range.
The formulaA = a×2²⁴ + b×2¹⁶ + c×2⁸ + d; B = 2^(32−p); network = floor(A/B)×B; mask = 2³²−B; hosts = p<31 ? B−2 : B

A worked example

Change “CIDR prefix length” from 24 to 26 and keep the other inputs from the worked example. The value for “Theoretical usable host addresses” goes from 254 to 62.

Example you can load

What to enter
Result for this example · Network address192.168.1.0

This is a fixed example; changing the form above does not change these numbers.

Assumptions & limits

Address arithmetic only: reserved ranges, public routability and provider restrictions are not checked. For /0–/30, the conventional host count excludes network and broadcast addresses. /31 assumes an RFC 3021 point-to-point link: both addresses identify endpoints, with no directed broadcast. /32 identifies a single host address; it has no directed broadcast.

Reference ·

Frequently asked questions

How is the result calculated?

Total addresses = 2^(32−p); p = CIDR prefix length. Theoretical usable host addresses: /0–/30 = 2^(32−p)−2; /31 = 2; /32 = 1.

Which units are used?

Octet: 8 bit, 0–255. CIDR prefix length: 0–32 bit. IPv4: 32 bit.

What assumptions apply?

Address arithmetic only: reserved ranges, public routability and provider restrictions are not checked. For /0–/30, the conventional host count excludes network and broadcast addresses. /31 assumes an RFC 3021 point-to-point link: both addresses identify endpoints, with no directed broadcast. /32 identifies a single host address; it has no directed broadcast.