MultiSwitch MultiSwitch ← Home
SEARCH
SEARCH
← Home Feedback

Slope & Distance Calculator

Two points → slope, distance, midpoint and line equation

Enter the coordinates of two points (x₁, y₁) and (x₂, y₂). Everything updates as you type, including vertical and horizontal lines.

–
Slope (m)
–
Distance
–
Midpoint
–
Slope-intercept form
–
Standard form
–
Angle to x-axis
–
Fractions are shown when the inputs are whole numbers; otherwise results are decimals rounded for display. See Terms.

How this works

The slope is rise over run: m = (y₂ − y₁) ÷ (x₂ − x₁). From (1, 2) to (4, 8) the line rises 6 and runs 3, so m = 2. A positive slope climbs from left to right, a negative slope falls, zero is flat, and a vertical line (run of 0) has an undefined slope.

The distance between the points comes from Pythagoras: d = √((x₂ − x₁)² + (y₂ − y₁)²). For the same points, d = √(3² + 6²) = √45 ≈ 6.708. The midpoint is the average of each coordinate: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2) = (2.5, 5).

The line through both points is written y = mx + b, where b is the y-intercept found from b = y₁ − m·x₁. Standard form Ax + By = C uses whole numbers where possible, and the angle to the x-axis is arctan(m).

FAQ

How do you find the slope from two points?

Subtract the y-values and divide by the difference in x-values, in the same order: m = (y₂ − y₁) / (x₂ − x₁). It doesn’t matter which point you call first, as long as you are consistent.

What does an undefined slope mean?

It means the two points share the same x-value, so the line is vertical and the run is zero. Its equation is simply x = (that value).

How do I find the equation of a line from two points?

Work out the slope m, then substitute one point into y = mx + b to find b. For (1, 2) and (4, 8): m = 2, so 2 = 2 × 1 + b and b = 0, giving y = 2x.

What is the distance formula?

d = √((x₂ − x₁)² + (y₂ − y₁)²). It is Pythagoras’ theorem applied to the horizontal and vertical gaps between the points.

How do I convert slope to an angle or a percentage grade?

Angle = arctan(slope), in degrees. Percentage grade = slope × 100, so a slope of 0.05 is a 5% grade, about 2.9°.