Utinzo

Slope Calculator

Calculate slope, y-intercept, line equation, angle of inclination, and distance between two points on a coordinate plane.

Did this tool work for you?

How to use this calculator

m = (y₂ − y₁) / (x₂ − x₁)

Slope m is the rise over run between two points. The y-intercept b satisfies y = mx + b at any point on the line.

  1. 1

    Enter the coordinates of two points: (x₁, y₁) and (x₂, y₂).

  2. 2

    The slope m = (y₂−y₁)/(x₂−x₁) is calculated along with the y-intercept.

  3. 3

    The full line equation y = mx + b is displayed, ready to use in further calculations.

  4. 4

    Distance, angle of inclination, and midpoint are also provided automatically.

Frequently asked questions

What happens when the two x-values are equal?

The run is 0, so the slope is undefined. The calculator reports “Undefined (vertical line)”, the equation x = (that value), and the distance. For (3, 1) and (3, 9) that is x = 3 and a distance of 8. It does not show a y-intercept, angle or midpoint for vertical lines.

What if I enter the same point twice?

It returns the error “Points are identical”. One point lies on infinitely many lines, so no single slope or equation can be given.

How is the angle of inclination reported?

It is the arctangent of the slope, in degrees, between −90° and 90°. A rising line of slope 2 gives 63.434949°, and a falling line of slope −2 gives −63.434949°. A horizontal line gives 0°. The angle is measured from the positive x-axis, so a negative value means the line descends to the right.

How is the equation formatted?

It is shown in slope-intercept form with the redundant parts removed: slope 2 and intercept 0 give y = 2x, slope −1 gives y = −x, and a horizontal line through (2, 1) and (9, 1) gives y = 1. Other lines appear as y = mx + b or y = mx − b depending on the intercept’s sign.

Is the equation exact?

Not always. The slope and intercept are rounded to six decimals for display, so a slope of 1/3 appears as 0.333333 in the equation. For exact work, write the slope as a fraction using the rise and run listed below the equation.

How do I convert a slope to a percent grade?

Multiply the slope by 100. Points (0, 0) and (100, 8) give a slope of 0.08 and an angle of 4.573921°, so the grade is 8%. This works as long as both coordinates use the same unit.

Why are grade and angle not the same number?

Grade is rise ÷ run times 100, while the angle is the arctangent of rise ÷ run, so they only agree approximately at very small slopes. A 100% grade (slope 1) is 45°, and an 8% grade is 4.573921°.

Does it give perpendicular or parallel lines?

No, it describes only the line through your two points. Take the slope it shows: a parallel line uses the same value, and a perpendicular line uses the negative reciprocal, such as −0.5 for a slope of 2.

About slope calculator

Slope, intercept and line equation from two points

From two points to a full description of the line

The slope is rise over run, (y₂ − y₁) ÷ (x₂ − x₁). Once the slope is known, the y-intercept follows from b = y₁ − m × x₁, and the line is y = mx + b. The calculator also returns the angle from the x-axis, the distance between the points and the midpoint. All of those come from the same pair of differences, shown as rise and run.

Calculator output for five pairs of points
PointsSlopeEquationAngleDistance
(1, 2) and (4, 8)2y = 2x63.434949°6.708204
(0, 5) and (4, −3)−2y = -2x + 5−63.434949°8.944272
(2, 1) and (9, 1)0y = 10°7
(1, 1) and (3, 2)0.5y = 0.5x + 0.526.565051°2.236068
(3, 1) and (3, 9)Undefinedx = 3not shown8

Worked example: a falling line

For (0, 5) and (4, −3) the rise is −8 and the run is 4, so the slope is −2. The y-intercept is 5, which you can see directly because x = 0 is one of the points. The calculator writes y = -2x + 5 and an angle of −63.434949°. The negative angle and slope say the same thing: every step right drops the line by two units. The midpoint, (2, 1), sits on the line, which you can confirm by substituting x = 2.

Worked example: a road grade

A road rises 8 m over a horizontal run of 100 m. Entering (0, 0) and (100, 8) returns a slope of 0.08, an angle of 4.573921° and a distance of 100.31949, the length along the slope. The grade is 8%, but the sloped distance is only about 0.3 m longer than the horizontal run. For gentle slopes, the horizontal and sloped distances are nearly the same; for steep ones they diverge.

Horizontal, vertical and identical points

A horizontal line has a rise of 0, so the slope is 0 and the equation shortens to y = b. A vertical line has a run of 0, so the slope is undefined and the equation is x = a. Identical points describe no line at all and are rejected. Handling these cases separately matters because dividing by a run of 0 would otherwise produce nonsense.

Using the result elsewhere

The slope-intercept equation is ready for plotting or for finding where two lines meet by setting their right-hand sides equal. Because the displayed numbers are rounded to six decimals, keep rise and run as fractions when you need exact answers, and compute the unrounded slope yourself for further calculations.

Slope Calculator – Utinzo

Learn more from an authoritative source:

Wikipedia
Related tools

Results are estimates for informational purposes only and do not constitute professional financial, medical, legal, or technical advice. Read full disclaimer →