Slope Calculator

About this calculator

The Slope Calculator works in two ways. Give it two points and it returns the slope m (as a decimal and a reduced fraction), the angle of incline θ, the distance between the points, the change in x and y, the line equation in slope-intercept form and both intercepts.

Or give it one point plus a slope (or angle) and a distance, and it finds the two points that lie that distance away along the line, one in each direction.

Point 1
Point 2
Known point
Enter the slope or the angle. If both are filled in, the slope is used.
degrees
Embed this calculator

Paste this code into a Custom HTML block on your site. The calculator fits the width of the block. Adjust the height in the code if you want more room for results.

Find this widget in the publisher directory

What is slope?

The slope of a line measures how steep it is: how much it rises or falls for each unit you move to the right. It is usually written m and defined as the change in y divided by the change in x, often summarized as "rise over run".

m = ΔY / ΔX = (Y₂ − Y₁) / (X₂ − X₁)
  • A positive slope climbs from left to right.
  • A negative slope falls from left to right.
  • A slope of zero is a horizontal line.
  • A vertical line has an undefined slope, because ΔX is zero.

If the two points are known

From two points the calculator finds everything about the line through them. Besides the slope, it reports:

  • Angle of incline θ, the direction from the first point to the second measured counterclockwise from the positive x-axis: θ = arctan(ΔY / ΔX), adjusted to the correct quadrant.
  • Distance between the points: d = √(ΔX² + ΔY²), which is the Pythagorean theorem.
  • Equation of the line in slope-intercept form, y = mx + b, where b = Y₁ − m · X₁ is the y-intercept. When the inputs are exact decimals, the equation is also shown with reduced fractions.
  • Intercepts: the y-intercept is b and the x-intercept is −b / m.

Worked example

For the points (3.5, −2) and (−7, 9.25): ΔX = −10.5 and ΔY = 11.25, so m = 11.25 / −10.5 = −15/14 ≈ −1.0714285714286. The intercept is b = −2 − (−15/14)(3.5) = 1.75, giving y = −15/14 x + 7/4. The distance is √(110.25 + 126.5625) = √236.8125 ≈ 15.388713396512, and because the second point is up and to the left of the first, θ ≈ 133.02506598912°.

If one point and the slope are known

Knowing a point, a slope and a distance pins down two possible second points, one in each direction along the line. With θ the angle of the line:

X₂ = X₁ ± d · cos θ    Y₂ = Y₁ ± d · sin θ    where m = tan θ

For example, from (3.5, −2) with slope 0.75 and distance 8, the direction has cos θ = 0.8 and sin θ = 0.6, so the two answers are (9.9, 2.8) and (−2.9, −6.8). You can enter the angle of incline in degrees instead of the slope; the two are linked by m = tan θ.

Slope, grade and angle

Slope is closely related to the percent grade used for roads and ramps: grade = slope × 100%. A 5% grade has a slope of 0.05 and an angle of about 2.86°. A 45° angle is a slope of 1, or a 100% grade.

Angle θSlope mGrade
5°0.08758.75%
10°0.176317.63%
30°0.577457.74%
45°1100%
60°1.7321173.21%

Parallel and perpendicular lines

Parallel lines have equal slopes. Perpendicular lines have slopes that multiply to −1, so a line perpendicular to one with slope 2 has slope −1/2. These facts make slope a quick test for right angles and parallel sides in coordinate geometry.

Point-slope form

Another way to write a line is point-slope form, y − y₁ = m(x − x₁). It is handy when you know one point and the slope, and it converts to slope-intercept form by expanding and solving for y. For the point (3.5, −2) and slope 0.75, it becomes y + 2 = 0.75(x − 3.5), which simplifies to y = 0.75x − 4.625.

Reading the angle θ

The angle reported here is the direction from the first point toward the second, measured counterclockwise from the positive x-axis, so it ranges from 0° up to 360°. A line has two directions, which is why the one-point mode lists two answers whose angles differ by exactly 180°.

Frequently asked questions

How do you find the slope between two points?
Subtract the y-values and the x-values and divide: m = (y₂ − y₁) / (x₂ − x₁). For (1, 2) and (4, 8), m = 6 / 3 = 2.
What does an undefined slope mean?
The line is vertical. The x-values are equal, so the run is zero and the division cannot be done. Its equation is x = constant.
How do I convert slope to an angle?
Take the arctangent: θ = arctan(m). A slope of 1 is 45°, and a slope of 0.75 is about 36.87°.
What is slope-intercept form?
y = mx + b, where m is the slope and b is the y-value where the line crosses the y-axis.

Formulas and sample results on this page were checked against independent references. Page last reviewed or updated . How we verify calculators. Project led by Shaun Connell.