Distance Formula Calculator

Updated July 2026

Enter two points and instantly find the straight-line distance between them, with the full worked substitution — plus the midpoint and the slope of the line through them. Switch on 3D mode to include a z-coordinate. Everything runs privately in your browser.

The distance between two points is d = √((x₂ − x₁)² + (y₂ − y₁)²). It is the length of the segment joining the points. For example, the points (1, 2) and (4, 6) are √(9 + 16) = √25 = 5 apart.
Leave off for the standard 2D distance formula.
Enter the coordinates of two points.
Distance (d)
Distance (exact)
Distance (decimal)
Midpoint
Slope
Δx (run)
Δy (rise)
Worked substitution

How this distance formula calculator works

The distance formula gives the straight-line distance between two points in the coordinate plane. Given points (x₁, y₁) and (x₂, y₂), the distance is d = √((x₂ − x₁)² + (y₂ − y₁)²). The horizontal gap and the vertical gap are squared, added, and the square root of the sum is the distance — which is why a distance is never negative.

The formula comes straight from the Pythagorean theorem: the horizontal difference (x₂ − x₁) and the vertical difference (y₂ − y₁) are the two legs of a right triangle, and the distance is the hypotenuse, so a² + b² = c² becomes the distance formula. This calculator also reports the midpoint ((x₁ + x₂) / 2, (y₁ + y₂) / 2) and the slope of the line through the points for extra context. Turn on 3D mode to add a z-coordinate and use d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²).

Worked example: for the points (1, 2) and (4, 6), the differences are x₂ − x₁ = 3 and y₂ − y₁ = 4, so d = √(3² + 4²) = √(9 + 16) = √25 = 5. The midpoint is (2.5, 4) and the slope is 4 / 3 ≈ 1.333.

Reference note: the exact value shows the simplified radical where possible (for example √8 = 2√2) and the decimal is rounded for display. In 3D mode the z-term is added under the same square root. The slope is reported in 2D only and is undefined when both x-values are equal.

Distance formula reference

PointsComputationDistance
(0, 0) and (3, 4)√(3² + 4²) = √255
(1, 2) and (4, 6)√(3² + 4²) = √255
(−2, −3) and (1, 1)√(3² + 4²) = √255
(0, 0) and (1, 1)√(1² + 1²) = √2≈ 1.414
(0, 0, 0) and (1, 2, 2)√(1² + 2² + 2²) = √93

Frequently asked questions

What is the distance formula?
The distance formula gives the straight-line distance between two points (x₁, y₁) and (x₂, y₂): d = √((x₂ − x₁)² + (y₂ − y₁)²). It returns the length of the segment joining the points in the coordinate plane.
How is the distance formula derived from the Pythagorean theorem?
The horizontal gap (x₂ − x₁) and the vertical gap (y₂ − y₁) form the two legs of a right triangle, and the distance is the hypotenuse. The Pythagorean theorem a² + b² = c² gives c = √((x₂ − x₁)² + (y₂ − y₁)²), which is the distance formula.
How do I find the distance between two points?
Subtract the x-values and square the result, subtract the y-values and square that result, add the two squares, then take the square root. For example (1, 2) and (4, 6) give √(3² + 4²) = √(9 + 16) = √25 = 5.
What is the midpoint between two points?
The midpoint is the point exactly halfway between the two points. You average each coordinate: M = ((x₁ + x₂) / 2, (y₁ + y₂) / 2). For (1, 2) and (4, 6) the midpoint is (2.5, 4).
Does the distance formula work in 3D?
Yes. In three dimensions you add the squared difference of the z-values: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). This calculator includes an optional 3D mode that uses this extended formula.
Can a distance be negative?
No. Distance is always zero or positive because the differences are squared before the square root is taken, so any negative signs cancel. A distance of zero means the two points are the same point.
⚡ Distance Formula Calculator — by larely ↗

Related tools

Final Grade Calculator

Find the grade you need on the final, plus weighted-grade and GPA calculators.

Percentage Calculator

Percent of a number, percent change, and percentage increase or decrease.

Statistics Calculator

Mean, median, mode, range and standard deviation from a list of numbers.

Fraction Calculator

Add, subtract, multiply and divide fractions, with simplification.

Quadratic Equation Solver

Solve ax²+bx+c=0 with roots, discriminant, vertex and steps.

Area Calculator

Calculate the area of rectangles, circles, triangles and more.

Right Triangle Calculator

Pythagorean theorem solver: find sides, angles, area and perimeter.

Ratio Calculator

Solve proportions, simplify ratios and scale them up or down.

GPA Calculator

Calculate your weighted GPA on the 4.0 scale from your courses and credit hours.

Resistor Color Code Calculator

Decode 4- and 5-band resistor color codes into resistance and tolerance.

Dilution Calculator

Solve C1V1 = C2V2 for stock dilutions and the solvent volume to add.

Ohm's Law Calculator

Solve for voltage, current, resistance or power from any two values.

Browse all 251 free tools →