subnet calculator

Professional IPv4 subnet calculator with CIDR and subnet mask conversion, network/broadcast/host range, wildcard mask, and quick subnet splits. Accessible, mobile-first, and accurate to RFCs.

Full original guide (expanded)

Data Source & Methodology

AuthoritativeDataSource: Internet Engineering Task Force (IETF) RFCs — RFC 4632 (CIDR), RFC 791 (IPv4), RFC 950 (Subnetting), RFC 3021 (/31). All calculations implement these specifications.
Tutti i calcoli si basano rigorosamente sulle formule e sui dati forniti da questa fonte.

The Formula Explained

Let \( p \) be the prefix length (0–32). Then:

\[ \text{Total addresses} = 2^{32-p} \]

\[ \text{Usable hosts} = \begin{cases} 2^{32-p} - 2, & \text{if } p \le 30 \\ 2, & \text{if } p = 31 \text{ (RFC 3021 point-to-point)} \\ 1, & \text{if } p = 32 \end{cases} \]

\[ \text{Wildcard mask} = \neg \text{Subnet mask} \quad\ \ \ \ \text{Network} = \text{IP} \ \&\ \text{Mask} \quad\ \ \ \ \text{Broadcast} = \text{Network} \ |\ \neg \text{Mask} \]

Glossary of Variables

  • IPv4 address: host address in dotted-decimal form.
  • CIDR prefix: number of leading 1 bits in the mask (e.g., /24).
  • Subnet mask: 32-bit mask that selects the network portion.
  • Wildcard mask: bitwise NOT of the subnet mask; useful for ACLs.
  • Network address: IP AND mask; identifies the subnet.
  • Broadcast address: last address in the subnet (all host bits 1), except /31 and /32 special cases.
  • Usable hosts: total assignable host addresses in the subnet.

How It Works: A Step-by-Step Example

Case: 192.168.10.42/24

  1. Mask from /24: 255.255.255.0 (24 leading 1s).
  2. Network: 192.168.10.0 = 192.168.10.42 AND 255.255.255.0.
  3. Broadcast: 192.168.10.255 = network OR wildcard (0.0.0.255).
  4. Total: \(2^{8}=256\) addresses; Usable: \(256-2=254\).
  5. Hosts: 192.168.10.1 through 192.168.10.254.

FAQ

Why does /31 show 2 usable addresses?

Per RFC 3021, /31 networks are for point-to-point links and don’t reserve network/broadcast, making both addresses usable.

What about /32?

/32 identifies a single host address; there’s 1 total address and no range to assign beyond the host itself.

Why is my custom mask considered invalid?

Masks must be contiguous (all 1s followed by all 0s). Non-contiguous masks like 255.255.0.255 are not valid per CIDR.

Does this handle private vs public ranges?

Yes, but it does not validate routability. It calculates pure subnet math regardless of private/public classification.

How many subnets can I split into?

Each time you increase the prefix by 1 (e.g., /24 → /25), you double the subnets. The preview caps display to 64 rows for performance.

Why might first/last host be “—” for /31 or /32?

For /31, both addresses are usable; some contexts don’t label first/last. For /32, there’s no host range beyond the single address.

Strumento sviluppato da Ugo Candido. Contenuti verificati da CalcDomain Editorial Board.
Ultima revisione per l'accuratezza in data


Audit: Complete
Formula (LaTeX) + variables + units
This section shows the formulas used by the calculator engine, plus variable definitions and units.
Formula (extracted LaTeX)
\[\text{Total addresses} = 2^{32-p}\]
\text{Total addresses} = 2^{32-p}
Formula (extracted LaTeX)
\[\text{Usable hosts} = \begin{cases} 2^{32-p} - 2, & \text{if } p \le 30 \\ 2, & \text{if } p = 31 \text{ (RFC 3021 point-to-point)} \\ 1, & \text{if } p = 32 \end{cases}\]
\text{Usable hosts} = \begin{cases} 2^{32-p} - 2, & \text{if } p \le 30 \\ 2, & \text{if } p = 31 \text{ (RFC 3021 point-to-point)} \\ 1, & \text{if } p = 32 \end{cases}
Formula (extracted LaTeX)
\[\text{Wildcard mask} = \neg \text{Subnet mask} \quad\ \ \ \ \text{Network} = \text{IP} \ \&\ \text{Mask} \quad\ \ \ \ \text{Broadcast} = \text{Network} \ |\ \neg \text{Mask}\]
\text{Wildcard mask} = \neg \text{Subnet mask} \quad\ \ \ \ \text{Network} = \text{IP} \ \&\ \text{Mask} \quad\ \ \ \ \text{Broadcast} = \text{Network} \ |\ \neg \text{Mask}
Formula (extracted text)
Let \( p \) be the prefix length (0–32). Then: \[ \text{Total addresses} = 2^{32-p} \] \[ \text{Usable hosts} = \begin{cases} 2^{32-p} - 2, & \text{if } p \le 30 \\ 2, & \text{if } p = 31 \text{ (RFC 3021 point-to-point)} \\ 1, & \text{if } p = 32 \end{cases} \] \[ \text{Wildcard mask} = \neg \text{Subnet mask} \quad\ \ \ \ \text{Network} = \text{IP} \ \&\ \text{Mask} \quad\ \ \ \ \text{Broadcast} = \text{Network} \ |\ \neg \text{Mask} \]
Variables and units
  • No variables provided in audit spec.
Sources (authoritative):
Changelog
Version: 0.1.0-draft
Last code update: 2026-01-19
0.1.0-draft · 2026-01-19
  • Initial audit spec draft generated from HTML extraction (review required).
  • Verify formulas match the calculator engine and convert any text-only formulas to LaTeX.
  • Confirm sources are authoritative and relevant to the calculator methodology.
Verified by Ugo Candido on 2026-01-19
Profile · LinkedIn
Formulas

(Formulas preserved from original page content, if present.)

Version 0.1.0-draft
Citations

Add authoritative sources relevant to this calculator (standards bodies, manuals, official docs).

Changelog
  • 0.1.0-draft — 2026-01-19: Initial draft (review required).