Distance between two points calculator

MA-20Math

Find the distance between two points, the midpoint and the equation of the line through them.

Midpoint
(2.5; 4)
Slope
1.333333
Line equation
y = 1.333333x + 0.666667
Angle of inclination
53.1301°

Last updated: October 2026 · Report a calculation error

Formulas

  • Distance: |AB| = √((x₂ − x₁)² + (y₂ − y₁)²) — the Pythagorean theorem.
  • Midpoint: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2).
  • Slope: m = (y₂ − y₁) ÷ (x₂ − x₁), and the line is y = mx + b.

Example: A(1, 2) and B(4, 6)

Δx = 3 and Δy = 4, so |AB| = √(9 + 16) = 5. The midpoint is (2.5, 4), the slope 4 ÷ 3 ≈ 1.333 and the line y = 1.333x + 0.667.

Frequently asked questions

How do I find distance in 3D?

Add the third coordinate: √(Δx² + Δy² + Δz²).

Can I use this for map coordinates?

Not for latitude and longitude — you need to allow for the Earth's curvature, for example with the haversine formula.

See alsoWhole category

  1. MA-01Percentage calculatorFind X% of a number, what percent one number is of another and percentage change.
  2. MA-02Root and exponent calculatorCalculate the n-th root or any power of a number.
  3. MA-03Fraction calculatorAdd, subtract, multiply and divide fractions with automatic simplification.
  4. MA-04Number base converterConvert numbers between decimal, binary, octal and hexadecimal.