Text utilities

Subnet Calculator

Find an IPv4 network, subnet mask, host range and address count from an address and CIDR prefix.

Text stays in your browserCopy your result
Data workspace
Data workspace

Check delimiters and structure before downloading the output.

See the method

Your source data

Runs on your device

Your transformed data

Your result

Let’s calculate.

Use the Calculate button to see your result.

Your content is processed locally.

How to use this tool

  1. Enter ipv4 address, cidr prefix length.
  2. Select Update result to view the result.
  3. Check the method and assumptions below before using the result.

Input reference and sample values

Use the units and choices shown for each field. Sample values are provided for practice, not as recommendations.

InputFormat and unitsSample
IPv4 addressEnter text using the format shown in the sample.192.168.1.42
CIDR prefix lengthWhole numbers only. Zero or positive. Maximum: 32.24

Result for these sample inputs

192.168.1.0/24
Subnet mask
255.255.255.0
Last address
192.168.1.255
Address count
256
Usable host range
192.168.1.1 – 192.168.1.254
Usable host count
254

The first and last addresses are excluded from the conventional host range.

Select Try the example in the form to load these values and calculate them again. This replaces the current form inputs. Compare the result with the method and worked explanation below.

The method, explained

Convert the IPv4 address to a 32-bit integer and apply the prefix mask using bitwise AND. The block contains 2^(32 − prefix) addresses. Conventional subnets reserve the first and last addresses; /31 point-to-point and /32 host routes are handled separately.

A WORKED EXAMPLE

Using ipv4 address = 192.168.1.42, cidr prefix length = 24, the result is 192.168.1.0/24. Change these example inputs to match your task; use the method above to check each step.

What to keep in mind

IPv4 only. This arithmetic does not determine address ownership, routing, public reachability or whether every address in the range may be assigned.

Reference: RFC 3021: 31-bit IPv4 point-to-point prefixes

Methodology maintained by ClarityKit. How these tools are built and checked.