Two points on a grid raise two natural questions: where is the point exactly halfway between them, and how far apart are they? The first is the midpoint formula, the second the distance formula. Together they are the foundation of coordinate geometry, and they appear in computer graphics, game development, CAD drawings, and placing a support or a fixing exactly in the middle of a span.
This guide explains both formulas and why they work, shows the reverse problem of finding a missing endpoint, extends everything to three dimensions, and flags the one situation, latitude and longitude, where the flat formulas give the wrong answer. Every example was checked with our calculator.
The midpoint is an average
The midpoint of two points is found by averaging their coordinates, one axis at a time:
M = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
Example: (−2, 3) and (6, −1)
x: (−2 + 6) ÷ 2 = 4 ÷ 2 = 2
y: (3 + (−1)) ÷ 2 = 2 ÷ 2 = 1
M = (2, 1)
Why an average? Moving from the first point to the second, x changes by 8 and y by −4. Halfway there, you have made half of each change: −2 + 4 = 2 and 3 − 2 = 1. Averaging is the same calculation written more compactly.
Midpoints do not have to be whole numbers. The midpoint of (1/2, 3) and (4, −2) is (9/4, 1/2), or (2.25, 0.5).
The distance formula is Pythagoras
The horizontal and vertical differences between two points form the legs of a right triangle. The straight-line distance is its hypotenuse:
d = √((x₂ − x₁)² + (y₂ − y₁)²)
Example: (−2, 3) and (6, −1)
Δx = 6 − (−2) = 8
Δy = −1 − 3 = −4
d = √(64 + 16) = √80 = 4√5 ≈ 8.944
Squaring removes the sign, so it does not matter which point you subtract from which. The exact form 4√5 comes from simplifying √80 = √(16 × 5); the Square Root Calculator does that for any number. For the underlying theorem, see the Pythagorean Theorem Calculator.
A useful check: the midpoint is always exactly half the distance from each endpoint. Here, each endpoint is 2√5 ≈ 4.472 from M.
Finding a missing endpoint
Sometimes you know one end of a segment and its midpoint, and need the other end. Because the midpoint is the average, the missing coordinate is twice the midpoint minus the known endpoint:
x₂ = 2 × Mx − x₁
y₂ = 2 × My − y₁
Example: known endpoint A = (1, 4), midpoint M = (3, −2)
x: 2 × 3 − 1 = 5
y: 2 × (−2) − 4 = −8
B = (5, −8)
Check by averaging: ((1 + 5) ÷ 2, (4 + (−8)) ÷ 2) = (3, −2). Correct.
This is handy for symmetric layouts: if a feature is centred on a point and you know where one end is, the other end is its reflection through the centre.
Extending to three dimensions
Both formulas gain one more term for the z-axis and otherwise work the same way.
M = ((x₁ + x₂)/2, (y₁ + y₂)/2, (z₁ + z₂)/2)
d = √(Δx² + Δy² + Δz²)
Example: (−2, 3, 1) and (6, −1, 5)
M = (2, 1, 3)
d = √(8² + (−4)² + 4²) = √(64 + 16 + 16) = √96 = 4√6 ≈ 9.798
Three-dimensional distance is used for 3D modelling, robotics and measuring straight-line distances inside rooms or buildings, such as a cable run from one corner of a room to the opposite ceiling corner.
When flat formulas do not apply: map coordinates
Latitude and longitude are angles on a curved Earth, not flat x and y coordinates. Plugging them into the distance formula gives a meaningless number of "degrees", and a degree of longitude covers less ground the further you are from the equator. Similarly, averaging two latitudes and longitudes is only a rough midpoint for points close together.
For real geographic distances, use a great-circle method such as the haversine formula, or a mapping tool. The flat formulas are fine for local site plans drawn on a grid in metres or feet.
How to use the Midpoint Calculator
- Open the Midpoint Calculator.
- Choose a mode: Midpoint & distance or Find endpoint. Then choose 2D or 3D.
- For a midpoint, enter the coordinates of Point 1 and Point 2. For an endpoint, enter the Known endpoint A and the Midpoint M. Fractions such as 1/2 and decimals are accepted, and the results stay exact.
- Read the result. In midpoint mode you get the Midpoint, the Midpoint (decimal), the Distance between the points in exact and decimal form, and the Distance to the midpoint. In endpoint mode you get the Missing endpoint B, its decimal form and the Segment length.
- In 2D, a graph plots the points and the segment. Open the steps to see each coordinate averaged (or doubled and subtracted) and the distance calculation.
Other ways to calculate
- By hand: both formulas are short. Bracket negative coordinates when substituting, and simplify the square root at the end.
- Spreadsheets:
=(A2+C2)/2for each midpoint coordinate and=SQRT((C2-A2)^2+(D2-B2)^2)for the distance. Good for many pairs at once. - CAD and drawing software: most have snap-to-midpoint and measure tools, which are faster when you are already working in a drawing.
For the slope and equation of the line through two points, use the Slope Calculator. The midpoint is also the simplest example of an average; the Average Calculator handles longer lists of numbers.
Common mistakes
Subtracting instead of adding
The midpoint uses (x₁ + x₂) ÷ 2. The difference (x₂ − x₁) belongs to the distance formula.
Forgetting to square before adding
d = √(Δx² + Δy²), not √(Δx + Δy) and not Δx + Δy.
Sign slips with negatives
6 − (−2) = 8, not 4. Brackets around negative values prevent most errors.
Using the midpoint formula for the endpoint
If you average the known endpoint and the midpoint, you get a quarter point, not the missing end. Use 2M − A.
Frequently asked questions
How do you find the midpoint of two points?
Add the x-coordinates and divide by 2, then do the same for the y-coordinates. For (−2, 3) and (6, −1), the midpoint is (2, 1).
How is the distance formula related to the Pythagorean theorem?
The differences in x and y are the legs of a right triangle, and the distance is its hypotenuse. The formula is a² + b² = c² solved for c.
How do I find the other endpoint if I know the midpoint?
Double each midpoint coordinate and subtract the known endpoint's coordinate. With A = (1, 4) and M = (3, −2), the other endpoint is (5, −8).
Does the midpoint formula work in 3D?
Yes. Average the z-coordinates as well. The midpoint of (−2, 3, 1) and (6, −1, 5) is (2, 1, 3).
Can I use the distance formula with latitude and longitude?
Not accurately. Those are angles on a sphere, so use a great-circle formula such as haversine or a mapping tool instead.