Distance and Midpoint Calculator

Distance, midpoint, and legs between two coordinate points.

Math and PercentUpdated 2026-10-111 min read
Distance and Midpoint Calculator
Distance
...
Midpoint...
Legs...

What it does

Two points on graph paper hide a right triangle between them. From (2,1) to (6,4) the run is 4 and the rise is 3, so Pythagoras gives 5 straight across with the center at (4, 2.5). The tool above prints distance, midpoint, and both legs for any pair.

The default is the textbook 3-4-5 triangle in disguise. Subtracting gives legs 4 by 3, squaring and adding gives 25, and the root is exactly 5. Averaging gives the midpoint (4, 2.5), which splits the segment into two equal halves.

Standard texts derive both formulas from the same picture. OpenStax intermediate algebra builds distance from the Pythagorean legs and midpoint from coordinate averages, flagging that distance subtracts while midpoint adds. LibreTexts workbooks repeat the pair with the same worked structure.

Order never matters here. Swapping the two points flips both subtractions, and squaring erases the signs; averaging ignores order entirely. Only mixing the formulas trips students: adding inside a root, or subtracting inside a midpoint.

How to use

  1. Type the first point x1 and y1.
  2. Type the second point x2 and y2.
  3. Read distance first for the length.
  4. Read midpoint for the center.
  5. Use legs to sketch the triangle.

Formula

d = sqrt((x2-x1)2 + (y2-y1)2). Mid = ((x1+x2)/2, (y1+y2)/2).
dx, dy
Run and rise between the points.
d
Straight segment length.
mid
Center point of the segment.

Plane geometry only; map and ball distances need their own great circle math. Units follow the coordinate units in.

Worked example

Example: (2,1) to (6,4)

Defaults: x1 2, y1 1, x2 6, y2 4.

  1. Legs: 6 minus 2 = 4, 4 minus 1 = 3.
  2. Squares: 16 + 9 = 25.
  3. Distance: sqrt(25) = 5.
  4. Midpoint: ((2+6)/2, (1+4)/2) = (4, 2.5).
  5. Tool shows 5, (4, 2.5), 4 by 3.

Reference table

Classic point pairs
PointsDistanceMidpoint
(0,0) to (3,4)5(1.5, 2)
(2,1) to (6,4)5(4, 2.5)
(-3,-1) to (2,3)6.4(-0.5, 1)

Limits

  • Flat plane only, no curves or spheres.
  • Coordinates cap at a billion for exactness.
  • No units conversion; grid units rule.
  • Rounding shows 2 decimals.

Common mistakes

  • Adding coordinates inside the root.
  • Subtracting inside the midpoint.
  • Forgetting the final square root.
  • Squaring after adding instead of before.
  • Reading legs as the answer.

Try it yourself

Quick checks. Answers sit tucked under each question.

(-3,-1) to (2,3)?

dx 5, dy 4, d sqrt(41) = 6.4, mid (-0.5, 1).

(0,0) to (3,4)?

d 5, mid (1.5, 2).

Same point twice?

Distance 0, midpoint the point itself.

Questions

Distance (2,1) to (6,4)?

5, with midpoint (4, 2.5).

Why subtract for distance?

Legs are coordinate gaps; Pythagoras needs them.

Why average for midpoint?

The center sits halfway along each axis.

Does order matter?

No. Squares and averages erase ordering.

Negative coordinates?

Fine. Gaps use absolute differences inside squares.

3D points?

Add a z gap squared; outside this page.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.