Distance Formula Calculator

Calculate the distance between two points using the distance formula. Supports 2D (x1,y1)-(x2,y2), 3D (x,y,z), and geographic distance (latitude/longitude, haversine). Shows steps, formula, midpoint and examples.

Full original guide (expanded)

Distance Formula Calculator

Compute distances in 2D, 3D, or on Earth using latitude and longitude, with formula steps and midpoint results.

Point A (x₁, y₁)

Point B (x₂, y₂)

Distance formula (2D)

Formula:

d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

This is derived from the Pythagorean theorem: the straight-line distance is the hypotenuse of a right triangle whose legs are the differences in x and y.

Distance formula (3D)

d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}

Haversine formula (lat/long)

d = 2R \arcsin \left(\sqrt{\sin^2\left(\frac{\varphi_2 - \varphi_1}{2}\right) + \cos(\varphi_1)\cos(\varphi_2)\sin^2\left(\frac{\lambda_2 - \lambda_1}{2}\right)}\right)

Where φ is latitude in radians, λ is longitude in radians, and R is Earth’s radius.

FAQs

What is the midpoint between two points?

Midpoint M between (x₁, y₁) and (x₂, y₂) is: M = ((x₁ + x₂)/2, (y₁ + y₂)/2). Our tool shows it for 2D/3D.

Can I use this for physics problems?

Yes. If your problem involves straight-line distance between two points in Cartesian space, this formula is standard.

What if I only have one coordinate different?

The formula still works — the other difference will be zero, so it reduces to the absolute difference on one axis.


Audit: Complete
Formula (LaTeX) + variables + units
This section shows the formulas used by the calculator engine, plus variable definitions and units.
Formula (extracted LaTeX)
\[','\\]
','\
Formula (extracted text)
Formula: d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} This is derived from the Pythagorean theorem: the straight-line distance is the hypotenuse of a right triangle whose legs are the differences in x and y.
Formula (extracted text)
d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}
Formula (extracted text)
d = 2R \arcsin \left(\sqrt{\sin^2\left(\frac{\varphi_2 - \varphi_1}{2}\right) + \cos(\varphi_1)\cos(\varphi_2)\sin^2\left(\frac{\lambda_2 - \lambda_1}{2}\right)}\right) Where φ is latitude in radians, λ is longitude in radians, and R is Earth’s radius.
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).