# IP / Subnet Calculator

> One page from jmrp.io, published as markdown. Index: https://jmrp.io/llms.txt

Canonical: https://jmrp.io/tools/subnet-calculator/
Language: en
Alternate: https://jmrp.io/es/tools/subnet-calculator/index.md
Updated: 2026-09-03
License: https://jmrp.io/license/
Category: network
Tags: networking, ip, subnet, cidr, ipv4, ipv6, vlsm

IPv4 and IPv6 subnet calculator with CIDR notation, VLSM planner, range-to-CIDR converter, and reverse DNS. Runs client-side.
Build-Date: 2026-09-06

Features:
- IPv4 and IPv6 subnet calculation
- VLSM planner with waste analysis
- Range-to-CIDR block conversion
- Address type detection and reverse DNS
- Runs locally in your browser

Questions answered:

**How do I calculate the number of usable hosts in a subnet?**

Usable hosts equal the total addresses in the prefix minus the network and broadcast addresses, so a /24 has 254 usable hosts (256 − 2). Enter the IP and CIDR prefix and the tool reports usable hosts, host range, broadcast, and mask automatically.

**What is the difference between a /30 and a /31 subnet?**

A /30 has 4 addresses with 2 usable hosts after reserving network and broadcast, while a /31 ([RFC 3021](https://datatracker.ietf.org/doc/html/rfc3021)) uses both of its 2 addresses for a point-to-point link with no broadcast. Both are common for router-to-router links.

**Why is /64 the standard subnet size for IPv6?**

A /64 prefix is required by SLAAC, which derives the 64-bit interface identifier from the host, so it is the standard size for almost every IPv6 subnet. The tool uses BigInt math to handle these 128-bit calculations accurately.

**How do I convert an arbitrary IP range into CIDR blocks?**

Use the Range to CIDR mode: enter the start and end IPv4 addresses and the tool returns the minimal set of CIDR prefixes that exactly cover the range. This is useful for firewall rules, route aggregation, and access control lists.

**Is my IP address data sent anywhere when I use this calculator?**

No. All calculations run entirely in your browser and no IP addresses or network data are sent to any server. The tool keeps working offline after the initial page load.


---

**Interactive tool** — this page hosts the working application itself, not a description of one.

## About This Tool

A comprehensive IP networking toolkit covering everything you need for IPv4
and IPv6 address planning. Four specialized calculators in one tool: subnet
calculator, address info, VLSM planner, and range-to-CIDR converter.

### Features

- **Full IPv4 and IPv6** — subnet calculation with BigInt math for 128-bit addresses
- **Auto-detect** — automatically identifies IPv4 vs IPv6 from your input
- **Smart CIDR parsing** — paste 192.168.1.0/24 and it auto-splits the prefix
- **Address type detection** — Private ([RFC 1918]()), CGNAT, Loopback, Link-Local, Multicast, Documentation, ULA, Teredo, 6to4, and more
- **Address converter** — binary, hex, integer, reverse DNS (PTR), IPv4-mapped IPv6, 6to4
- **VLSM planner** — allocate subnets of different sizes with waste calculation
- **Range to CIDR** — convert arbitrary IP ranges to optimal CIDR blocks
- **Bit boundary visualization** — colored network/host bit display
- **Common presets** — quick access to typical IPv4 and IPv6 prefix lengths
- **Share link** — URL parameters for bookmarking and sharing
- **Copy results** — one-click copy of all calculated values

## How do I use it?

### Subnet Calculator

1. Enter an IPv4 address (e.g., `192.168.1.0`) or IPv6 address (e.g., `2001:db8::`)
2. Set the CIDR prefix length or click a preset button
3. View network address, broadcast, mask, wildcard, host range, address type,
  and more
4. Scroll down to see the bit boundary visualization showing network vs host
  bits

### Address Info

1. Enter any IP address, integer, or hex value (e.g., `3232235777` = 192.168.1.1)
2. View all representations: binary, hex, integer, reverse DNS, IPv4-mapped
  IPv6, and 6to4
3. Identify address type, class, and scope

### VLSM Planner

1. Enter a base IPv4 network (e.g., `10.0.0.0/16`)
2. Add subnet requirements with names and required host counts
3. Click Calculate to see optimal allocation sorted by size, with waste
  analysis

### Range to CIDR

1. Enter start and end IPv4 addresses (e.g., `192.168.1.0` to `192.168.3.255`)
2. View the minimal set of CIDR blocks covering the range

## IPv4 Subnet Reference

### Common Subnet Sizes

| CIDR | Subnet Mask | Addresses | Usable Hosts | Typical Use |
| --- | --- | --- | --- | --- |
| `/32` | `255.255.255.255` | 1 | 1 | Host route |
| `/31` | `255.255.255.254` | 2 | 2 | Point-to-point link (RFC 3021) |
| `/30` | `255.255.255.252` | 4 | 2 | Point-to-point link |
| `/29` | `255.255.255.248` | 8 | 6 | Small office |
| `/28` | `255.255.255.240` | 16 | 14 | Small network |
| `/27` | `255.255.255.224` | 32 | 30 | Department |
| `/26` | `255.255.255.192` | 64 | 62 | Floor / building |
| `/25` | `255.255.255.128` | 128 | 126 | Large department |
| `/24` | `255.255.255.0` | 256 | 254 | Standard LAN |
| `/16` | `255.255.0.0` | 65,536 | 65,534 | Large site |
| `/8` | `255.0.0.0` | 16,777,216 | 16,777,214 | ISP / Class A |

### IPv4 Classes

| Class | Range | Default Mask | Networks | Purpose |
| --- | --- | --- | --- | --- |
| A | `1.0.0.0 – 126.255.255.255` | `/8` | 126 | Large organizations |
| B | `128.0.0.0 – 191.255.255.255` | `/16` | 16,384 | Medium organizations |
| C | `192.0.0.0 – 223.255.255.255` | `/24` | 2,097,152 | Small organizations |
| D | `224.0.0.0 – 239.255.255.255` | N/A | N/A | Multicast |
| E | `240.0.0.0 – 255.255.255.255` | N/A | N/A | Reserved / Experimental |

### Private and Reserved Ranges

| Range | CIDR | Purpose | RFC |
| --- | --- | --- | --- |
| `10.0.0.0` | `/8` | Private network | RFC 1918 |
| `172.16.0.0` | `/12` | Private network | RFC 1918 |
| `192.168.0.0` | `/16` | Private network | RFC 1918 |
| `100.64.0.0` | `/10` | CGNAT / Shared | [RFC 6598]() |
| `127.0.0.0` | `/8` | Loopback | [RFC 1122]() |
| `169.254.0.0` | `/16` | Link-Local / APIPA | [RFC 3927]() |
| `192.0.2.0` | `/24` | Documentation (TEST-NET-1) | [RFC 5737]() |
| `198.51.100.0` | `/24` | Documentation (TEST-NET-2) | RFC 5737 |
| `203.0.113.0` | `/24` | Documentation (TEST-NET-3) | RFC 5737 |
| `224.0.0.0` | `/4` | Multicast | [RFC 5771]() |

## IPv6 Reference

### Common Prefix Lengths

| Prefix | Addresses | Typical Use |
| --- | --- | --- |
| `/128` | 1 | Host address |
| `/127` | 2 | Point-to-point link ([RFC 6164]()) |
| `/64` | 2^64 | Standard subnet (SLAAC required) |
| `/56` | 2^72 | Residential site (256 /64s) |
| `/48` | 2^80 | Enterprise site (65,536 /64s) |
| `/32` | 2^96 | ISP allocation |

### IPv6 Special Addresses

| Address / Prefix | Purpose | RFC |
| --- | --- | --- |
| `::/128` | Unspecified | [RFC 4291]() |
| `::1/128` | Loopback | RFC 4291 |
| `::ffff:0:0/96` | IPv4-Mapped IPv6 | RFC 4291 |
| `64:ff9b::/96` | NAT64 translation | [RFC 6052]() |
| `2001:db8::/32` | Documentation | [RFC 3849]() |
| `2002::/16` | 6to4 tunneling | [RFC 3056]() |
| `fc00::/7` | Unique Local Address (ULA) | [RFC 4193]() |
| `fe80::/10` | Link-Local | RFC 4291 |
| `ff00::/8` | Multicast | RFC 4291 |

## Privacy

All calculations run entirely in your browser. No IP addresses or network data
are sent to any server. The tool works offline after initial page load.

## Linux Command Reference

### Show IP addresses

```bash
ip -4 addr show
```

**Output — IPv4 addresses on all interfaces**

```text
inet 192.168.1.100/24 brd 192.168.1.255 scope global eth0
```

### Show IPv6 addresses

```bash
ip -6 addr show scope global
```

**Output — Global IPv6 addresses**

```text
inet6 2001:db8::1/64 scope global
```

### Routing table

```bash
ip route show
```

**Output — IPv4 routing table**

```text
default via 192.168.1.1 dev eth0
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100
```

### Calculate subnet with ipcalc

```bash
ipcalc 192.168.1.0/24
```

**Output — Subnet details**

```text
Network:   192.168.1.0/24
Netmask:   255.255.255.0
Broadcast: 192.168.1.255
HostMin:   192.168.1.1
HostMax:   192.168.1.254
Hosts/Net: 254
Class C, Private Internet
```

### Reverse DNS lookup

```bash
dig -x 8.8.8.8 +short
```

**Output — PTR record for 8.8.8.8**

```text
dns.google.
```

### Scan a subnet

```bash
nmap -sn 192.168.1.0/24 | grep "Nmap scan report"
```

**Output — Discover live hosts on a subnet**

```text
Nmap scan report for 192.168.1.1
Nmap scan report for 192.168.1.100
```

## What is VLSM?

**Variable Length Subnet Masking (VLSM)** allows dividing a network into subnets of different sizes, minimizing wasted addresses. The algorithm:

1. Sort requirements by host count (largest first)
2. For each requirement, find the smallest power-of-2 block that fits (hosts +
  2 for network/broadcast addresses)
3. Align the block to its natural boundary
4. Allocate and advance to the next available space

In IPv6, VLSM is less relevant because /64 is the standard prefix for all
subnets (required for SLAAC). The immense address space makes variable sizing
unnecessary.

## How does range-to-CIDR conversion work?

Converting an arbitrary IP range to CIDR blocks finds the minimal set of
prefixes that exactly cover the range. For each position:

1. Find the largest aligned block starting at the current address
2. Ensure the block does not extend beyond the end of the range
3. Record the block and advance past it

This is useful for firewall rules, route aggregation, and access control lists
where CIDR notation is required.

