CalcMate

Slope Calculator

Enter the coordinates of two points and get the slope of the line through them, its angle of inclination, the y-intercept, the distance between the points, their midpoint and the line equation — all from the same four numbers.

Slope2
Y-intercept-1
Line equationy = 2x - 1
Angle of inclination degrees63.43
Distance between the points6.71
Midpoint x3.5
Midpoint y6

The equation line rounds its coefficients to 4 decimal places; the numeric rows round to 2.

Formula and calculation

m=y2−y1x2−x1b=y1−mx1distance=(x2−x1)2+(y2−y1)2angle=tan⁡−1(m)\begin{gathered}m = \dfrac{y_2 - y_1}{x_2 - x_1} \quad b = y_1 - m x_1\\[6pt]\text{distance} = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} \quad \text{angle} = \tan^{-1}(m)\end{gathered}
Standard coordinate geometry: slope is rise over run, and the angle of inclination is the textbook angle measured from the positive x-axis, between 0° and 180°. The distance and midpoint come from the same right triangle, and the line equation is the two-point form rearranged into y = mx + b.

Worked example

For the points (2, 3) and (5, 9): the slope is 2, so the line rises 2 units for every 1 unit across, and it crosses the y-axis at -1. In slope-intercept form the line is y = 2x - 1, and its angle of inclination is 63.43°. The two points are 6.71 apart, and the midpoint between them is (3.5, 6).

Rise over run, grades and the angle of a slope

Slope is rise over run, and roads quote the same number as a percentage: a slope of 0.05 is a 5% grade, and the 1:12 ratio the ADA standards allow for a new wheelchair ramp is a slope of 0.0833, or 8.33%. The angle version of a slope is tan−1(m): 0.05 is about 2.9°, and a 45° line has a slope of exactly 1. One trap: on a falling line the angle of inclination is measured from the positive x-axis and lands between 90° and 180°, so a slope of −1 gives 135° — while the tan−1 button on a scientific calculator returns −45°. Both describe the same line; this page shows the inclination used in textbooks.

What the results mean

Slope
The slope of the line: how much y changes for every 1 unit that x increases. A slope of 2 means the line rises 2 units for every 1 across; a negative slope falls. A vertical line has no slope and shows undefined (vertical line).
Y-intercept
The y-intercept: the y-value where the line crosses the y-axis, at x = 0. It is undefined for a vertical line, which crosses the y-axis only when its equation is x = 0.
Line equation
The line in slope-intercept form, y = mx + b, with your numbers filled in — for example y = 2x - 1. Coefficients are rounded to 4 decimal places for display; a vertical line is written as x = c instead.
Angle of inclination
The angle of inclination: the angle between the line and the positive x-axis, measured counterclockwise from 0° up to just under 180°. Horizontal is 0°, a line rising at 45° is 45°, falling lines are past 90°, and a vertical line is 90°.
Distance
The straight-line distance between the two points, from the Pythagorean theorem: √((x₂ − x₁)² + (y₂ − y₁)²).
Midpoint x
The x-coordinate of the midpoint — the point exactly halfway between the two points: (x₁ + x₂) ÷ 2.
Midpoint y
The y-coordinate of the midpoint: (y₁ + y₂) ÷ 2. The midpoint sits on the line, which is a quick way to check that your coordinates are right.

Frequently asked questions

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

Divide the vertical change by the horizontal change: m = (y₂ − y₁) ÷ (x₂ − x₁). For the points (2, 3) and (5, 9) that is (9 − 3) ÷ (5 − 2) = 6 ÷ 3 = 2, so the line rises 2 units for every 1 unit to the right.

What does an undefined slope mean?

It means the line is vertical: both points have the same x-value, so the run is zero and the rise-over-run fraction would divide by zero. The line still exists and is written x = c, but it has no slope, no y-intercept and no y = mx + b form — this page shows it as undefined (vertical line) instead of failing.

How do I convert a slope to degrees?

Take the arctangent of the slope: a slope of 1 is 45°, a slope of 2 is about 63.43°, and a slope of −1 is 135° as an angle of inclination. If you have a road grade instead, divide it by 100 first: an 8% grade is a slope of 0.08, about 4.57°.

How do I find the distance between two points?

Use the Pythagorean theorem on the horizontal and vertical gaps: distance = √((x₂ − x₁)² + (y₂ − y₁)²). From (2, 3) to (5, 9) the gaps are 3 and 6, so the distance is √(9 + 36) = √45, about 6.71.