Aller au contenu
CalcHub

Distance Between Two Points Calculator

Calculate the straight-line distance between two points from their coordinates, with the midpoint, slope, and the horizontal and vertical distances.

Distance Between Two Points CalculatorEn direct

Comment utiliser cette calculatrice

  1. 1Enter the x and y coordinates of the first point.
  2. 2Enter the x and y coordinates of the second point.
  3. 3Read the straight-line distance between them.
  4. 4See the midpoint, slope, and the horizontal and vertical distances too.

Comment ça marche

Distance and midpoint

distance = √((x₂ − x₁)² + (y₂ − y₁)²)
midpoint = ((x₁ + x₂)/2, (y₁ + y₂)/2)
slope = (y₂ − y₁) ÷ (x₂ − x₁)
a direct application of the Pythagorean theorem

The distance between two points in a plane is found by treating the horizontal and vertical gaps between them as the two legs of a right triangle. The horizontal gap is the difference in the x-coordinates, the vertical gap the difference in the y-coordinates, and the straight-line distance is the hypotenuse — so by the Pythagorean theorem it equals the square root of the sum of those two differences squared. This is the distance formula, and it works for any two points regardless of where they sit relative to each other, because squaring removes the sign of the differences. The midpoint, the exact centre of the segment joining the points, is found by averaging the coordinates, and the slope of the line through them is the vertical difference divided by the horizontal one.

Exemple détaillé

The distance from (0, 0) to (3, 4) is √((3 − 0)² + (4 − 0)²) = √(9 + 16) = √25 = 5. The midpoint is ((0 + 3)/2, (0 + 4)/2) = (1.5, 2), and the slope of the line joining them is 4 ÷ 3 ≈ 1.33.

Distance Between Two Points Calculator : le guide complet

The distance formula is Pythagoras in disguise

The distance formula can look intimidating with its nested squares and square root, but it is nothing more than the Pythagorean theorem wearing coordinates. Picture the two points on a grid and draw a right triangle whose horizontal leg runs the difference in their x-values and whose vertical leg runs the difference in their y-values. The straight-line distance between the points is the hypotenuse of that triangle, so it equals the square root of the sum of the two legs squared — exactly a² + b² = c² rewritten with coordinate differences.

Seeing the formula this way makes it far easier to remember and to trust. There is nothing to memorise beyond 'differences, squared, added, square-rooted', and it explains why the signs of the differences do not matter: squaring makes them positive, just as a distance should always be positive whichever point you start from. Once you recognise the right triangle hiding in any pair of points, the distance formula stops being a rule to recall and becomes something you can reconstruct at will.

Midpoint and slope: the other two questions

Given two points, three questions come up constantly, and the distance is only the first. The midpoint answers 'what is the exact centre of the segment between them?' and it is found simply by averaging: the x of the midpoint is the average of the two x-values, and likewise for y. This is intuitive — the middle of a segment is halfway along in each direction — and it is used everywhere from finding the centre of a shape to bisecting a line in a construction.

The slope answers 'how steeply does the line through the points rise or fall?' It is the vertical change divided by the horizontal change, the classic 'rise over run'. A positive slope climbs left to right, a negative one descends, zero is flat, and a vertical line has an undefined slope because its horizontal change is zero, which would mean dividing by zero. Together, distance, midpoint, and slope characterise the relationship between two points almost completely, which is why they so often appear side by side in coordinate geometry problems.

Where coordinate distance is used

The distance between two points is one of the most frequently computed quantities in any field that uses coordinates, which today is nearly all of them. Navigation and mapping software constantly measure straight-line (as-the-crow-flies) distances between locations as a first step before computing routes. Video games and physics simulations check the distance between objects thousands of times a second to detect collisions, trigger events, or apply forces that weaken with separation.

In data science and machine learning, the same formula — generalised to many dimensions — measures how similar two data points are, powering everything from recommendation systems to clustering algorithms, where 'nearby' points are treated as alike. Computer graphics use it for lighting, shadows, and effects that depend on distance. Even the humble task of finding how far apart two pixels or two GPS readings are comes back to this one idea. Because coordinates are the universal language for describing position, the distance between two of them is a calculation that quietly runs beneath an enormous amount of modern technology.

Questions fréquentes

How do I find the distance between two points?

Use the distance formula: √((x₂ − x₁)² + (y₂ − y₁)²). Subtract the coordinates to get the horizontal and vertical gaps, square each, add them, and take the square root. From (0,0) to (3,4) that's √(9 + 16) = 5.

Why does the distance formula use squares?

Because it's the Pythagorean theorem: the horizontal and vertical gaps are the legs of a right triangle, and the distance is the hypotenuse, √(leg² + leg²). Squaring also removes the sign of the differences, so the distance comes out positive whichever point you start from.

How do I find the midpoint?

Average the coordinates: the midpoint is ((x₁ + x₂)/2, (y₁ + y₂)/2). For (0,0) and (3,4) it's (1.5, 2). This works because the centre of a segment is exactly halfway along in both the horizontal and vertical directions.

What is the slope between two points?

The slope is the vertical change divided by the horizontal change, (y₂ − y₁) ÷ (x₂ − x₁) — 'rise over run'. It measures steepness: positive climbs, negative descends, zero is flat. A vertical line has undefined slope, since its horizontal change is zero.