Midpoint Calculator: Distance, Slope and Missing Endpoint

Midpoint and Distance Calculator

Find a midpoint, distance, slope, section point, or missing endpoint from 2D or 3D Cartesian coordinates.


First point P₁

Second point P₂

Internal division ratio

The section point divides P₁P₂ in the ratio m:n. A 1:1 ratio is the midpoint.

Use periods for decimals and no thousands separators. Coordinates may be positive, negative, or zero.


Midpoint and distance formulas

For endpoints P₁=(x₁,y₁) and P₂=(x₂,y₂), the midpoint is M=((x₁+x₂)/2,(y₁+y₂)/2). In 3D, add (z₁+z₂)/2.

The 2D distance is d=√((x₂−x₁)²+(y₂−y₁)²); in 3D, add (z₂−z₁)² under the square root. A section point dividing P₁P₂ in ratio m:n is ((nx₁+mx₂)/(m+n),(ny₁+my₂)/(m+n)).

If one endpoint and midpoint are known, the missing endpoint is P₂=2M−P₁, coordinate by coordinate.

Checked examples

InputsMidpoint or endpointDistance
P₁=(0,0), P₂=(6,8)M=(3,4)10
P₁=(−2,5), P₂=(4,−1)M=(1,2)√72≈8.4853
P₁=(1,2,3), P₂=(4,6,3)M=(2.5,4,3)5
P₁=(−1,−2,−3), P₂=(1,2,3)M=(0,0,0)√56≈7.4833
P₁=(2,4), M=(5,7)P₂=(8,10)√72≈8.4853
P₁=(1,1,1), M=(3,4,5)P₂=(5,7,9)√116≈10.7703
P₁=(0,0), P₂=(9,6), ratio 2:1Section=(6,4)√117≈10.8167
P₁=(3,1), P₂=(3,9)M=(3,5)8; vertical slope

How to use the calculator

  1. Select two endpoints or missing-endpoint mode.
  2. Select 2D or 3D coordinates.
  3. Enter the requested coordinates and, when available, a positive section ratio.
  4. Select Calculate coordinates and review the midpoint, distance, slope, line, and check.

Limits and interpretation

  • Coordinates may be positive, negative, or zero and are limited to a magnitude of 1e150.
  • Section-ratio terms m and n must both be positive; this tool calculates internal division.
  • A vertical 2D line has undefined slope and is written as x=constant.
  • Slope and a single y=mx+b equation are not reported in 3D because a 3D line requires a parametric or vector equation.
  • Displayed results use approximately 14 significant digits and JavaScript double-precision arithmetic.
  • These formulas use Cartesian coordinates, not latitude/longitude or great-circle distance.

Frequently asked questions

Is the midpoint the same as the average?

Yes. Each midpoint coordinate is the arithmetic mean of the corresponding endpoint coordinates.

How do I find a missing endpoint?

Double each midpoint coordinate and subtract the known endpoint coordinate.

What does a 2:1 section ratio mean?

The section point is two-thirds of the way from P₁ toward P₂ because the share toward P₂ is m=2 and the total is m+n=3.

Can this calculate geographic distance?

No. Geographic coordinates lie on Earth’s curved surface and require geodesic formulas rather than Cartesian distance.

Related calculators

Use the Triangle Calculator for general triangle geometry, the Pythagorean Theorem Calculator for right triangles, or the Average Calculator for datasets, or the System of Equations Calculator for simultaneous linear equations.