Slope Calculator

Find the slope of a line from two points, along with the y-intercept, the full equation (y = mx + b), the angle and the distance between the points.

Two points
Point 1
x₁
y₁
Point 2
x₂
y₂

Enter the coordinates of two points. The slope is the rise over the run: (y₂ − y₁) ÷ (x₂ − x₁). A vertical line (same x) has an undefined slope.

Slope (m)
—
Enter both points
Line equation
—
y-intercept (b)
—
Angle
—
Δx (run)
—
Δy (rise)
—
Distance between points
—

Slope measures steepness: positive rises left-to-right, negative falls, zero is flat. The equation is in slope-intercept form, y = mx + b.

How to Find Slope From Two Points

Divide the change in y by the change in x between the two points. For the line passing through (1, 2) and (3, 6), the rise is 6 − 2 = 4 and the run is 3 − 1 = 2, so the slope is m = 2. The y-intercept is 0, giving y = 2x, a line at about 63.43°.

  1. Rise: y₂ − y₁ = 6 − 2 = 4.
  2. Run: x₂ − x₁ = 3 − 1 = 2.
  3. Slope: 4 ÷ 2 = 2.
  4. Y-intercept: b = 2 − 2 × 1 = 0, so y = 2x.

Formula: Slope m = (y₂ − y₁) ÷ (x₂ − x₁), i.e. rise over run. The y-intercept is b = y₁ − m × x₁, giving the line equation y = mx + b. The angle of the line is angle = atan(m) × 180 ÷ π, expressed in degrees. The distance between the two points is distance = √((x₂ − x₁)^2 + (y₂ − y₁)^2). When x₁ equals x₂ (a vertical line), the slope and angle are undefined/90°, since division by zero (run = 0) has no result.

  • x₁, y₁: coordinates of Point 1
  • x₂, y₂: coordinates of Point 2

Example Scenarios

Point 1 (x₁, y₁)Point 2 (x₂, y₂)Slope (m)
(1, 2)(3, 6)2
(0, 0)(4, 2)0.5
(2, 5)(2, 9)Undefined (vertical line)
(-3, 4)(5, -4)-1
(1, 1)(5, 1)0 (horizontal line)
(0, 10)(10, 0)-1

How to Convert Slope to Degrees

Take the arctangent of the slope and convert from radians to degrees. Slope and angle don’t grow in step: doubling the slope from 1 to 2 adds only about 18°.

SlopeAngle
0.05 (5% grade)2.86°
0.5 (6 in 12 pitch)26.57°
145°
263.43°

Getting the Right Answer Every Time

Keep each point’s coordinates together and watch the signs.

  • Mixing the x from one point with the y from the other is the most common error; swapping whole points is fine.
  • Check the sign. A line rising from left to right has a positive slope; a falling line has a negative one.
  • What is the slope of a vertical line? Undefined, because the run is zero, while horizontal lines have a slope of 0.

To find the y-intercept with two points, work out the slope first and then use b = y − mx with either point. The same math covers road grades and roof pitches, as the table shows. For real ramps, stairs and roofs, follow local building codes. See the slope article on Wikipedia for how the formula connects to the line equation.

Common questions about slope

How do you find slope from two points?Subtract the y-values, subtract the x-values in the same order, and divide: m = (y₂ − y₁) ÷ (x₂ − x₁). For (1, 2) and (3, 6), m = 4 ÷ 2 = 2.
How do you find the y-intercept with two points?Find the slope m first, then plug either point into b = y − mx. The calculator uses Point 1, so for (1, 2) with m = 2, b = 2 − 2 × 1 = 0 and the line is y = 2x.
How do you convert slope to degrees?Take the arctangent of the slope and multiply by 180 ÷ π. A slope of 1 is 45°, a slope of 2 is about 63.43° and a slope of 0.5 is about 26.57°.
What is the slope of a vertical line?It is undefined. Both points share the same x-coordinate, so the run is zero and rise ÷ run has no value; the calculator reports it as undefined with an angle of 90°.
Can the slope be zero, and what does that mean?Yes. A slope of zero means the line is horizontal, with no rise between the points (y₁ equals y₂). The equation becomes y = b, a constant.
What does a negative slope tell me about a line?The line falls from left to right: as x increases, y decreases. The bigger the negative number, the more sharply it drops.

Related Calculators

The distance formula here relies on square roots, so the square root calculator is a handy companion for checking that step by hand. If your two points come from a quadratic equation’s graph, the quadratic formula calculator can find its roots, and the triangle calculator extends these same coordinate-geometry ideas to angles and side lengths. See also the Ice and Water Shield Calculator. See also the CSS Long Shadow Generator. For a related estimate, try the Grade Adjusted Pace Calculator.

Related Calculators