Skip to content

Slope Calculator

Slope m = (y2 - y1) / (x2 - x1); vertical lines (x2 = x1) are undefined.

Maintained by the Calcenzo team. Last reviewed September 25, 2026. Methodology

Slope Calculator

A slope calculator finds the slope of the line through two points using rise over run. Formula: m = (y2 – y1) / (x2 – x1), provided x2 != x1. The points (1, 2) and (4, 8) give a slope of 2.

slope calculator
Slope calculator chart: slope examples.

How to use the slope calculator

  1. Enter x₁ and y₁ for the first point.
  2. Enter x₂ and y₂ for the second point.
  3. Read the slope.

How the slope calculator works

The slope calculator finds the slope of the straight line through two points, (x₁, y₁) and (x₂, y₂). Slope measures steepness: how much y changes for each unit change in x. It uses the rise-over-run formula:

  • m = (y₂ − y₁) ÷ (x₂ − x₁)

A positive slope rises from left to right, a negative slope falls, and zero means a horizontal line. If both points have the same x, the line is vertical and the slope is undefined, so the tool shows a message instead of a number. Results show up to 6 decimal places.

Slope calculator worked example

Enter the points (1, 2) and (4, 8). The rise is 8 − 2 = 6 and the run is 4 − 1 = 3, so the slope calculator returns m = 6 ÷ 3 = 2. For every step of 1 to the right, the line rises 2. The order of the points does not matter, as long as you subtract in the same order on top and bottom.

Point 1 Point 2 Slope Angle
(1, 2) (4, 8) 2 63.43°
(-2, 5) (4, -1) -1 -45.00°
(2, 3) (8, 3) 0 0.00°
(0, 0) (12, 1) 0.083333 4.76°
(0, 0) (3, 6) 2 63.43°

Writing the equation of the line

With the slope known, the y-intercept is b = y₁ − m × x₁. For (1, 2) and slope 2, b = 2 − 2 = 0, so the line is y = 2x. In point-slope form, the same line is y − 2 = 2(x − 1). Both forms describe every point on the line. The slope calculator gives m; work out b by hand in one step.

Slope, angle and grade

The angle a line makes with the x-axis is arctan(m). A slope of 1 is 45°, and a slope of 2 is about 63.43°. Engineers and road signs often use percent grade, which is slope × 100: a slope of 0.08 is an 8% grade. A wheelchair ramp at 1:12 has a slope of about 0.0833, an angle of about 4.76° and a grade of 8.33%.

Parallel and perpendicular lines

Parallel lines have equal slopes. Perpendicular lines have slopes that multiply to −1, so a line perpendicular to slope 2 has slope −0.5. You can use the slope calculator on two pairs of points to test whether lines are parallel or perpendicular.

Real-world slope

Slope is a rate of change. In a distance-time graph it is speed, in a cost graph it is the cost per unit, and on a roof it is the pitch. A roof that rises 6 inches over 12 inches of run has a slope of 0.5, the 6/12 pitch roofers talk about. In economics and science, the slope of a fitted line shows how much one quantity changes with another.

Common mistakes

The most common error is mixing the order: subtracting y₂ − y₁ on top but x₁ − x₂ on the bottom flips the sign. Another is swapping x and y, which gives the reciprocal. Check that a line that visibly rises has a positive slope.

Reading slope from a graph

On a graph, pick two points where the line crosses grid corners, count the vertical change and the horizontal change, and divide. Moving right is a positive run. If the line goes down as you move right, the rise is negative, so the slope is negative. Steeper lines have larger absolute slopes; a slope of 5 is much steeper than a slope of 0.2.

Tips

  • Subtract in the same order on top and bottom.
  • Remember that a vertical line has no slope.
  • Multiply by 100 to get percent grade.
  • Use the slope calculator result to write y = mx + b.

Related calculators:

Sources

OpenStax Prealgebra 2e, 11.4: Understand slope of a line; OpenStax Algebra and Trigonometry 2e, 7.2: Right triangle trigonometry.

Formula and method

m = (y2 - y1) / (x2 - x1), provided x2 != x1.

Two-point slope formula from analytic geometry. Vertical segments are rejected as undefined.

Questions about this calculator

What is the slope formula?

m = (y₂ − y₁) ÷ (x₂ − x₁).

What is the slope of a vertical line?

Undefined.

How do I convert slope to an angle?

Angle = arctan(slope).

What is percent grade?

Slope × 100.

Does the point order matter?

No, if you subtract in the same order.

Check the assumptions and units before relying on a result. Financial, tax and health estimates do not replace advice for your individual circumstances.

Report a calculation issue