Math · Coordinate geometry

Distance, midpoint and slope calculator.

Enter two points (x₁, y₁) and (x₂, y₂). Entries can be integers, decimals or fractions like 1/2.

For (1, 2) and (4, 6) the distance is √(3² + 4²) = 5, the midpoint is (5/2, 4), the slope is 4/3 and the line is y = (4/3)x + 2/3, or 4x − 3y = -2.

d = √((x₂−x₁)² + (y₂−y₁)²)m = (y₂−y₁) / (x₂−x₁)Opened sources 8 October 2026

Advertisement

Your numbers

Your result

Fill the form and press Calculate.

The formulas

The distance between (x₁, y₁) and (x₂, y₂) is √((x₂ − x₁)² + (y₂ − y₁)²), which is the Pythagorean theorem on the horizontal and vertical differences. The midpoint is ((x₁ + x₂)/2, (y₁ + y₂)/2). The slope is m = (y₂ − y₁) / (x₂ − x₁), undefined for a vertical line. With the slope, the point-slope form is y − y₁ = m(x − x₁), which rearranges to the slope-intercept form y = mx + b.

Worked example

(1, 2) and (4, 6): Δx = 3, Δy = 4, so d = √25 = 5, the midpoint is (5/2, 4) and m = 4/3. Then b = 2 − (4/3)(1) = 2/3, giving y = (4/3)x + 2/3, and in standard form 4x − 3y = -2. For (−2, 3) and (5, −1): d = √65 = 8.062258, midpoint (3/2, 1), m = −4/7 and the line is y = (-4/7)x + 13/7.

Limits

Two identical points do not define a line. A vertical line is reported as x = constant with an undefined slope. The angle of inclination is measured from the positive x-axis, from −90° to 90°.

Sources, opened 15 October 2026: OpenStax, Algebra and Trigonometry 2e, 2.1 The Rectangular Coordinate Systems and Graphs (distance formula and midpoint formula); OpenStax, Algebra and Trigonometry 2e, 4.1 Linear Functions (slope m = (y₂ − y₁)/(x₂ − x₁), point-slope form and slope-intercept form).

Frequently asked questions

How do you find the distance between two points?

Square the horizontal and vertical differences, add them and take the square root. For (1, 2) and (4, 6) that is √(9 + 16) = 5.

How do you find the midpoint of two points?

Average the x-coordinates and average the y-coordinates. The midpoint of (1, 2) and (4, 6) is (2.5, 4).

How do you find the slope between two points?

Divide the rise by the run: m = (y₂ − y₁) / (x₂ − x₁). For (1, 2) and (4, 6) the slope is 4/3.

What if the line is vertical?

If x₁ = x₂ the run is zero, so the slope is undefined and the line is x = x₁.

How do I write the equation of the line?

Find the slope m, then use y − y₁ = m(x − x₁) and rearrange to y = mx + b. The calculator shows slope-intercept, point-slope and standard forms.

Learning aid

Educational calculator with worked steps. Check answers and the required method against your own course or textbook. Nothing you type leaves your browser.

Advertisement
Advertisement