Skip to content

Distance Formula Calculator

Enter the coordinates of two points to get the straight-line distance between them, exact where possible, plus the midpoint and slope of the segment joining them.

Calculator Details

Equation of the line:y = (4/3)x + 2/3See results ↓

Slope and line through two points, a line from a point and a slope, the other endpoint from a midpoint, or a quadratic equation

x-coordinate of the first point

y-coordinate of the first point

x-coordinate of the second point

y-coordinate of the second point

Your Results

Equation of the line: y = (4/3)x + 2/3

Equation of the line

y = (4/3)x + 2/3

Slope m = 4/3

Slope (m)

4/3

≈ 1.333333333

Graph

P₁P₂
Line y = (4/3)x + 2/3. Axes cross at (0, 0); not to scale.

The slope is 4/3 and the line is y = (4/3)x + 2/3; the points are 5 apart.

Compare scenarios

Save these inputs as a scenario, change them, and compare the results side by side.

Loading, available in a moment

Detailed Breakdown

Properties of the line y = (4/3)x + 2/3
PropertyExactNote
Slope (m)4/3≈ 1.333333333
y-intercept (b)2/3
x-intercept−1/2
Slope-intercept formy = (4/3)x + 2/3y = mx + b
Point-slope formy − 2 = (4/3)(x − 1)y − y₁ = m(x − x₁)
Standard form4x − 3y = −2Ax + By = C
Angle of inclination53.13010235°From the positive x-axis
Distance between points5≈ 5
Midpoint(5/2, 4)

How This Calculator Works

How the Line Is Found

Slope first, then the intercept from one known point, all in exact fractions:

m = (y₂ − y₁) ÷ (x₂ − x₁) = (6 − (2)) ÷ (4 − (1)) = 4 ÷ 3 = 4/3

b = y₁ − m·x₁ = 2 − (4/3)·(1) = 2/3

y = (4/3)x + 2/3

d = √(Δx² + Δy²) = √((3)² + (4)²) = 5

Frequently Asked Questions

Where does the distance formula come from?

From the Pythagorean theorem. The horizontal gap x₂ − x₁ and the vertical gap y₂ − y₁ are the two legs of a right triangle, and the segment between the points is its hypotenuse, so d² = (x₂ − x₁)² + (y₂ − y₁)².

Does it matter which point I call the first one?

No. Swapping the points changes the signs of the differences, but squaring removes the sign, so the distance is the same. Only the slope's sign and the order in an equation depend on which point is which.

How do I find the distance in three dimensions?

Add the third difference under the square root: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). From (1, 2, 3) to (4, 6, 15) that is √(9 + 16 + 144) = √169 = 13. This calculator works in two dimensions.

Can I use this for distances on a map?

For a city grid or a small area with flat x-y coordinates, yes. For latitude and longitude over long distances, no: the Earth is curved, and the great-circle (haversine) formula is needed. Driving distance is longer again, because roads are not straight.

Included: slope, intercepts, slope-intercept, point-slope and standard forms, distance, midpoint and angle for lines; the other endpoint of a segment from one end and the midpoint; discriminant, exact real or complex roots, vertex, vertex and factored forms and completing the square step by step for quadratics. Inputs are converted to exact fractions from their decimal digits.

Left out: cubic and higher-degree equations, systems of equations, inequalities and fraction input such as 1/3 (enter 0.3333 or scale the equation). The graph is a preview, not to scale.

Distance Formula Calculator: Distance Between Two Points

By FindMySum · Last reviewed

A distance formula calculator finds how far apart two points are on a flat plane. The distance formula, d = √((x₂ − x₁)² + (y₂ − y₁)²), is the Pythagorean theorem written in coordinates: the differences in x and in y are the legs of a right triangle, and the distance is the hypotenuse. This page also gives the midpoint and the slope of the line through the two points.

Worked example

Find the distance between (1, 2) and (4, 6).

  1. Horizontal difference: 4 − 1 = 3.
  2. Vertical difference: 6 − 2 = 4.
  3. Square and add: 3² + 4² = 9 + 16 = 25.
  4. Square root: d = √25 = 5.

The two points are exactly 5 units apart, the 3-4-5 right triangle in disguise. The midpoint of the segment is (2.5, 4), and its slope is 4 ÷ 3.

When the sum under the root is not a perfect square, the calculator gives the exact form as well as a decimal: from (1, 2) to (3, 8) the distance is √40 = 2√10 ≈ 6.325.

Common slips

Subtract before you square, not after: (4 − 1)² is 9, while 4² − 1² is 15. Keep negative coordinates in brackets: from (−2, 3) to (4, −5), the differences are 6 and −8, giving √(36 + 64) = 10. And do not forget the final square root; 25 is the squared distance, not the distance.

For the midpoint on its own, use the midpoint calculator; for the slope and the equation of the line, the slope and line calculator.

Sources

This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.

Spotted a wrong result or a bug? Report a problem

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy