Distance Between Two Points Calculator

Point 1

Point 2

Distance between the points5
Midpoint(1.5, 2)
Horizontal change (Δx)3
Vertical change (Δy)4
Slope of the line through them1.3333
How this was calculated
  1. Distance = √((x₂−x₁)² + (y₂−y₁)²) = √((3)² + (4)²) = √(25) = 5. It is the Pythagorean theorem applied to the right triangle whose legs are the horizontal and vertical gaps.
  2. The midpoint simply averages the coordinates: ((0 + 3)/2, (0 + 4)/2) = (1.5, 2).

This distance between two points calculator finds the straight-line distance between any two points in a coordinate plane. Enter the coordinates of your first point (x₁, y₁) and your second point (x₂, y₂), and the calculator returns the distance along with the midpoint and slope. The distance between (x₁, y₁) and (x₂, y₂) is √((x₂−x₁)² + (y₂−y₁)²), which applies the Pythagorean theorem to the horizontal and vertical gaps. Distance is never negative and does not depend on which point is called first. The midpoint is the average of the coordinates: ((x₁+x₂)/2, (y₁+y₂)/2). For example, the distance from (0, 0) to (3, 4) is exactly 5, with a midpoint of (1.5, 2) and a slope of 4/3 ≈ 1.3333. A vertical pair like (1, 1) to (1, 5) has a distance of 4 and an undefined slope, because Δx = 0.

The underlying method is the accepted standard because it directly applies the Pythagorean theorem, the foundational geometric relationship for right triangles, to the coordinate grid. This approach works for any two points in a plane, whether the gaps are positive, negative, or zero. Distance does not depend on which point is labelled 1 or 2, while slope does depend on direction of travel but not on labelling. This page shows the formula, step-by-step workings, worked examples, and sources so you can verify every result. Verified examples include (−1, 2) to (4, −6), which has Δx = 5, Δy = −8, a distance of √89 ≈ 9.43, a midpoint of (1.5, −2), and a slope of −1.6.

Worked examples

(0, 0) to (3, 4)

The 3-4-5 triangle: distance exactly 5, midpoint (1.5, 2), slope 1.3333. (0 · 0 · 3 · 4)

Distance between the points5
Midpoint(1.5, 2)
Horizontal change (Δx)3
Vertical change (Δy)4
Slope of the line through them1.3333

(−1, 2) to (4, −6)

Δx = 5 and Δy = −8, so the distance is √89 ≈ 9.43 and the line falls with slope −1.6. (-1 · 2 · 4 · -6)

Distance between the points9.43
Midpoint(1.5, -2)
Horizontal change (Δx)5
Vertical change (Δy)-8
Slope of the line through them-1.6

(1, 1) to (1, 5) — a vertical pair

Distance 4 straight up; the slope is undefined because Δx = 0 — the case that breaks naive slope formulas. (1 · 1 · 1 · 5)

Distance between the points4
Midpoint(1, 3)
Horizontal change (Δx)0
Vertical change (Δy)4
Slope of the line through themUndefined (vertical line)

Pythagoras in a coordinate costume

The distance between two points calculator relies on a simple insight: any pair of coordinates on a grid can be turned into a right triangle. Take two points, (x₁, y₁) and (x₂, y₂). The horizontal gap between them is Δx = x₂ − x₁, and the vertical gap is Δy = y₂ − y₁. These two gaps form the legs of a right triangle, and the straight-line distance you want is the hypotenuse. That means the distance between (x₁, y₁) and (x₂, y₂) is √((x₂−x₁)² + (y₂−y₁)²) — the Pythagorean theorem applied to the horizontal and vertical gaps.

The classic illustration is the 3-4-5 triangle. Travel from (0, 0) to (3, 4): your horizontal leg is 3, your vertical leg is 4, and the hypotenuse is √(9 + 16) = √25 = 5. The distance is exactly 5. Along the way, the midpoint of that segment sits at (1.5, 2), and the slope of the line connecting the points is 4/3, or about 1.3333. The same logic holds for less tidy numbers. From (−1, 2) to (4, −6), the horizontal gap is 5 and the vertical gap is −8, giving a distance of √(25 + 64) = √89, which is about 9.43. The midpoint there is (1.5, −2), and the slope is −1.6.

A vertical pair of points is the simplest case of all. From (1, 1) to (1, 5), the horizontal gap is zero, so there is no horizontal leg at all. The distance is just the vertical gap: 4. The slope, however, is undefined, because dividing by a zero horizontal gap is not allowed. This is one of the few situations where distance and slope tell very different stories — distance always gives you a clean number, while slope can break down entirely.

Two properties keep the formula honest. First, distance is never negative, and it does not depend on which point you call point 1 or point 2. Whether you travel from (0, 0) to (3, 4) or from (3, 4) to (0, 0), the answer is still 5. Second, the midpoint is simply the average of the coordinates: ((x₁ + x₂)/2, (y₁ + y₂)/2). Slope is the odd one out — it does not care which point is labeled 1 or 2, but it does depend on the direction of travel, so reversing your path flips its sign.

Worked examples

The table below shows three worked examples that cover the most common cases a distance between two points calculator handles: a standard diagonal, a pair with negative coordinates, and a vertical pair. Each row is computed from the formula √((x₂−x₁)² + (y₂−y₁)²), which applies the Pythagorean theorem to the horizontal and vertical gaps between the two points.

The first example, from (0, 0) to (3, 4), is the classic 3-4-5 right triangle. The horizontal gap is 3 and the vertical gap is 4, so the distance is exactly 5. The midpoint is (1.5, 2), and the slope is 4/3, or about 1.3333. The second example, from (−1, 2) to (4, −6), has Δx = 5 and Δy = −8, so the distance is √89, which is about 9.43. Its midpoint is (1.5, −2), and its slope is −1.6.

The third example, from (1, 1) to (1, 5), is a vertical pair because both points share the same x-coordinate, so Δx = 0. The distance is simply 4, the difference in y-values. The slope is undefined because division by zero is not possible. The midpoint is (1, 3), found by averaging the coordinates: ((x₁+x₂)/2, (y₁+y₂)/2).

Two properties hold across all three examples. Distance is never negative and does not depend on which point is called first — swapping the labels changes nothing. Slope, however, does depend on the direction of travel, though not on which point is labelled 1 or 2.

Point 1Point 2DistanceMidpointSlope
(0, 0)(3, 4)5(1.5, 2)4/3 ≈ 1.3333
(−1, 2)(4, −6)√89 ≈ 9.43(1.5, −2)−1.6
(1, 1)(1, 5)4(1, 3)undefined (vertical)

The midpoint, and why it is just an average

The distance between two points calculator gives you the length of the straight path connecting the two coordinates. But sometimes you don't want the path's length — you want the point sitting halfway along it. That point is the midpoint, and the formula for it is simpler than the distance formula because it skips the squaring and the square root entirely. The midpoint is just the average of the coordinates: ((x₁ + x₂) / 2, (y₁ + y₂) / 2). You average the x-values to get the x-coordinate of the midpoint, and you average the y-values to get the y-coordinate.

This coordinate-by-coordinate averaging is why the midpoint lands exactly halfway between the two endpoints in both the horizontal and vertical directions at the same time. Take the verified example of the segment from (−1, 2) to (4, −6). The distance is √89 ≈ 9.43, computed from Δx = 5 and Δy = −8 using the Pythagorean theorem. But the midpoint skips all of that. You just add the x-coordinates and divide by 2: (−1 + 4) / 2 = 3 / 2 = 1.5. Then do the same for y: (2 + (−6)) / 2 = (−4) / 2 = −2. So the midpoint is (1.5, −2), sitting squarely in the middle of the segment regardless of the segment's slope or length.

Contrast that with the first verified example, (0, 0) to (3, 4). Here the midpoint is (1.5, 2), found the same way: (0 + 3) / 2 = 1.5 and (0 + 4) / 2 = 2. Notice that the x-coordinate of this midpoint, 1.5, matches the x-coordinate of the midpoint in the previous example — a coincidence that highlights how averaging works independently along each axis. The y-coordinates differ (2 versus −2) because the endpoints have different vertical positions. The midpoint tracks each axis separately, which is why a distance between two points calculator and a midpoint calculation complement each other: one measures the span, the other locates the center.

Averages behave consistently even in edge cases. For the vertical pair (1, 1) to (1, 5), the x-values are identical, so their average is still 1 — the midpoint is (1, 3), directly between the two points on the same vertical line. The distance is 4 and the slope is undefined because Δx = 0, but none of that complicates the midpoint. And just as distance does not depend on which point you call first, the midpoint is also direction-independent: swapping the labels on point 1 and point 2 gives the same average either way, because addition is commutative.

Slope: rise over run, and the vertical exception

Slope is the ratio of the vertical gap to the horizontal gap between two points, often called rise over run. The formula is slope = Δy/Δx, where Δy = y₂ − y₁ and Δx = x₂ − x₁. This ratio tells you how steeply the line connecting the two points tilts. A slope of 1 means the line rises one unit for every one unit it runs horizontally. A slope of 0 means the line is perfectly flat, with no rise at all. Unlike distance, which never changes based on direction, slope depends on the direction of travel — though it does not depend on which point you label as point 1 or point 2.

Consider the verified example from (−1, 2) to (4, −6). Here Δx = 5 and Δy = −8, so the slope is −8/5, which equals −1.6. The negative sign tells you the line is going downhill as you move from left to right. The same pair of points gives a distance of √89 ≈ 9.43, which is always positive regardless of direction. This contrast matters: a distance between two points calculator returns one positive value for any pair of coordinates, but the slope carries a sign that reflects whether y is increasing or decreasing along the path.

The vertical exception occurs when Δx = 0, meaning both points share the same x-coordinate. In that case the slope formula involves division by zero, so the slope is undefined. The verified pair (1, 1) to (1, 5) illustrates this: the distance is 4, calculated directly from the difference in y-values, but the slope cannot be computed because there is no horizontal run. The line is straight up and down, and no single number can describe its steepness as a ratio of rise to run.

The horizontal counterpart is simpler. When Δy = 0, the slope is 0, because the rise is zero no matter how large the run. A pair like (0, 0) to (3, 4) shows a middle ground: Δx = 3 and Δy = 4, so the slope is 4/3 ≈ 1.3333. The distance is exactly 5, the classic 3-4-5 triangle. In every case, the slope and the distance describe different properties of the same two points — one captures direction and steepness, the other captures length alone.

Slope is undefined when Δx = 0 — a vertical line has no run to divide by. Distance, however, is still valid and equals the absolute difference in y-values.

Signs and quadrants

A common question when using a distance between two points calculator is whether negative coordinates change the result. The short answer for distance itself is no. Because the distance formula squares both the horizontal gap (x₂−x₁) and the vertical gap (y₂−y₁) before adding them, any negative signs disappear. Squaring a negative number gives the same positive result as squaring its positive counterpart. That means the distance between (−1, 2) and (4, −6) is the same √89 ≈ 9.43 you would get if both coordinates were positive with the same gaps of Δx = 5 and Δy = −8.

What negative coordinates do affect is the sign of Δy and the slope. In that same example from (−1, 2) to (4, −6), Δx equals 5 and Δy equals −8, producing a slope of −1.6. The negative slope tells you the line is falling as you move from left to right. Distance, by contrast, is never negative and does not depend on which point you call first. Slope also does not depend on which point is labelled 1 or 2, but it does depend on your direction of travel along the line.

Quadrants matter when you interpret intermediate values like the midpoint. The midpoint formula averages the coordinates: ((x₁+x₂)/2, (y₁+y₂)/2). For (−1, 2) and (4, −6), the midpoint lands at (1.5, −2), which sits in a different quadrant than either starting point. The verified 3-4-5 triangle from (0, 0) to (3, 4) has its midpoint at (1.5, 2) and a positive slope of 4/3 ≈ 1.3333, because both Δx and Δy are positive. Same distance structure, different signs in the supporting values.

A vertical pair such as (1, 1) to (1, 5) shows another way signs and coordinates interact. Here Δx is 0, so the distance is simply 4 and the slope is undefined because you cannot divide by zero. The calculator handles the distance cleanly, but the slope column will flag the undefined case rather than produce a number.

From flat maps to real maps

The distance between two points calculator above works on a flat, planar surface — a grid where the horizontal and vertical directions stay perfectly perpendicular no matter how far you travel. That is exactly the right model for graph paper, screen pixels, building floor plans, and most everyday geometry. The underlying math is the Pythagorean theorem applied to the horizontal and vertical gaps: the distance between (x₁, y₁) and (x₂, y₂) is √((x₂−x₁)² + (y₂−y₂)²). It is the same idea as finding the long side of a right triangle when you already know the two shorter sides.

A quick check shows the formula in action. From (0, 0) to (3, 4) the horizontal gap is 3 and the vertical gap is 4, giving exactly 5 — the classic 3-4-5 triangle. The midpoint sits at (1.5, 2), and the slope is 4/3, or about 1.3333. A second example moves from (−1, 2) to (4, −6): here Δx is 5 and Δy is −8, so the distance is √89, about 9.43, with a midpoint of (1.5, −2) and a slope of −1.6. And when two points share the same x-coordinate, such as (1, 1) and (1, 5), the pair is purely vertical — the distance is simply 4 and the slope is undefined because Δx equals 0.

Two properties hold in every case. Distance is never negative, and swapping which point you call first does not change the result. Slope, by contrast, depends on the direction of travel but not on which point is labelled 1 or 2. The midpoint, meanwhile, is just the average of the coordinates: ((x₁+x₂)/2, (y₁+y₂)/2).

Real maps of Earth, however, are not flat grids. Latitude and longitude describe positions on a sphere, so the straight-line gap between two cities is not the planar distance the formula above produces. For those coordinates you need the haversine formula instead — the same underlying idea of combining perpendicular gaps, but adapted to a curved surface. Use this tool for flat-plane geometry and reach for haversine when your points live on the globe.

FAQs

What is the distance between (0, 0) and (3, 4)?

The distance is exactly 5. Using the distance formula, you calculate √(3² + 4²) = √25, which equals 5. This is a classic example of a 3-4-5 right triangle, where the horizontal change is 3 and the vertical change is 4.

How do you find the midpoint of two points?

Average the coordinates. For example, (−1, 2) and (4, −6) meet at ((−1+4)/2, (2−6)/2) = (1.5, −2). Add the x-values and divide by 2, then add the y-values and divide by 2. The result is the point exactly halfway between the two original points.

Can distance between two points be negative?

No. The distance formula takes the square root of a sum of squares, so the result is always zero (when both points are the same) or positive. A distance can never be negative because squares are never negative, and a square root of a non-negative number is never negative.

What if the two points form a vertical line?

Distance is just |Δy| — 4 for (1, 1) to (1, 5) — and the slope is undefined because Δx = 0. When two points share the same x-coordinate, the distance formula simplifies to the absolute value of the difference in y-values.

Does the order of the points matter?

Not for distance or midpoint. For slope, swapping both points leaves the value unchanged because both Δx and Δy flip sign together. The distance formula squares each difference, so the sign disappears. The midpoint formula averages coordinates, which also works regardless of order.

Is this the same as driving distance?

No. This is straight-line (Euclidean) distance, measuring the shortest path between two points. Road distance follows the street network and is always longer. Driving distance depends on available roads, turns, and traffic routes, while Euclidean distance ignores all obstacles and measures a direct line.

Sources

Related calculators

Pythagorean Theorem Calculator
Find the hypotenuse from two legs, or a missing leg from the hypotenuse — with area and perimeter of the triangle thrown in.
Slope Calculator
Slope, angle, distance and midpoint between two points, plus the full equation of the line through them — the whole coordinate-geometry answer in one go.
Triangle Calculator
Triangle area three ways: base × height, Heron's formula from three sides, or two sides with the included angle — plus perimeter and side classification.
Circle Calculator
Give any one of radius, diameter, circumference or area and get all four — with the step from the value you know to the ones you don't.