Small tools. Better flow.

IP & CIDR calculator

Calculate IPv4/IPv6 networks and address ranges.

Usage guide

Your input stays in this browser.

Input & options

Text 1 MB

View code examples ↓

Result

Your result will appear here.

Code examples

Starting points for your own code. Run them in the environment shown below.

Node.js 22+ · ES module (.mjs)

Current inputs apply only to fields used by the example. Selected files are not embedded.

Install dependencies

npm install ipaddr.js
import ipaddr from "ipaddr.js";
const [ip, prefix] = ipaddr.parseCIDR("192.168.1.10/24");
if (ip.kind() !== "ipv4") throw new Error("This example supports IPv4");
const value = ip.toByteArray().reduce((number, byte) => (number << 8) | byte, 0) >>> 0;
const mask = prefix === 0 ? 0 : (0xffffffff << (32 - prefix)) >>> 0;
const network = (value & mask) >>> 0;
const broadcast = (network | ~mask) >>> 0;
const dotted = number => [24, 16, 8, 0].map(shift => (number >>> shift) & 255).join(".");
console.log({ network: dotted(network), broadcast: dotted(broadcast), mask: dotted(mask) });

Put it to work

Calculate IPv4/IPv6 networks and address ranges.

Details that matter

Format and meaning

IPv4 /31 uses two addresses; /32 uses one. IPv6 has no broadcast address.

Supported scope and limits

Text 1 MB

Split inputs that exceed the limit. If a format or algorithm is unsupported, choose a tool that matches your requirements instead of silently changing the format.