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.

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

Common questions

Which inputs does this calculation need?

Find an IPv4 network, subnet mask, host range and address count from an address and CIDR prefix. Enter ipv4 address, cidr prefix length. The filled example is editable and is not a saved personal record.

How should I interpret the result?

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

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