ThisCalculator

Math

Slope Calculator Step by Step: How to Find Slope

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Slope Calculator Step by Step: How to Find Slope

This slope calculator finds the slope of a line from two points you enter, and it shows every step of the calculation. You type in the x and y coordinates of two points, and you get back the slope (m), the rise, the run, and the equation of the line in slope-intercept form. The step-by-step breakdown makes it easy to see exactly how the slope is computed and how to apply it to your own math problems.

Formula

The slope of a line measures how steep it is. Given two points on the line, (x�, y�) and (x₂, y₂), the slope is the change in y divided by the change in x:

m = (yâ‚‚ – yâ‚�) / (xâ‚‚ – xâ‚�)

  • m = slope (unitless)
  • (xâ‚�, yâ‚�) = coordinates of the first point
  • (xâ‚‚, yâ‚‚) = coordinates of the second point
  • Rise = yâ‚‚ – yâ‚� (vertical change)
  • Run = xâ‚‚ – xâ‚� (horizontal change)

This formula works for any straight line, whether it goes up, down, or is flat. If the line is vertical, the run is zero, and the slope is undefined because you cannot divide by zero.

Worked Example

Using the default values from the calculator: point 1 = (1, 2) and point 2 = (4, 8).

  1. Identify the coordinates: x� = 1, y� = 2, x₂ = 4, y₂ = 8.
  2. Find the rise: yâ‚‚ – yâ‚� = 8 – 2 = 6.
  3. Find the run: xâ‚‚ – xâ‚� = 4 – 1 = 3.
  4. Divide rise by run: m = 6 / 3 = 2.

So the slope is 2. The calculator displays this as 2.00 (rounded to 2 decimals). The equation of the line is y = 2x + 0 (since the y-intercept is 0). You can check: when x = 1, y = 2; when x = 4, y = 8. Both points satisfy the equation.

How to Use the Slope Calculator

Enter the x and y coordinates of two points on the line. The order matters: the first point is (xâ‚�, yâ‚�) and the second is (xâ‚‚, yâ‚‚). The calculator computes the rise and run, then the slope. It also gives the equation in slope-intercept form (y = mx + b) by calculating the y-intercept b = yâ‚� – m·xâ‚�.

Here are the steps to follow manually:

  • Label your points: (xâ‚�, yâ‚�) and (xâ‚‚, yâ‚‚).
  • Subtract the y-coordinates: yâ‚‚ – yâ‚�.
  • Subtract the x-coordinates: xâ‚‚ – xâ‚�.
  • Divide the first result by the second.
  • If the run is zero, the slope is undefined (vertical line).

The calculator does all this instantly, but understanding the steps helps you check your homework or verify a line’s steepness.

When to Use the Slope Formula

Slope is used in algebra, geometry, physics, and everyday situations like ramps, roofs, and road grades. You use it whenever you need to find the rate of change between two points on a straight line. For example:

  • Finding the steepness of a hill given two elevation points.
  • Calculating the speed of an object from a distance-time graph.
  • Determining the trend of data in a scatter plot (linear regression).
  • Writing the equation of a line given two points.

If you have a real-world situation that can be modeled with a straight line, the slope tells you how much the dependent variable changes per unit of the independent variable.

Reading the Result

The slope value tells you the direction and steepness:

  • Positive slope: the line goes up from left to right (y increases as x increases).
  • Negative slope: the line goes down from left to right (y decreases as x increases).
  • Zero slope: the line is horizontal (y stays constant).
  • Undefined slope: the line is vertical (x stays constant).

The larger the absolute value of the slope, the steeper the line. For example, a slope of 5 is steeper than a slope of 2. A slope of -3 is steeper than a slope of -1, but it goes downward.

Common Mistakes and How to Avoid Them

Students often make these errors when calculating slope:

  • Swapping the order of subtraction: You must subtract the same point’s coordinates consistently. If you use (yâ‚‚ – yâ‚�) for the rise, you must use (xâ‚‚ – xâ‚�) for the run. Mixing them changes the sign.
  • Forgetting to subtract in both numerator and denominator: Some people subtract y’s but add x’s. Always subtract, never add.
  • Dividing by zero: If xâ‚‚ = xâ‚�, the slope is undefined, not zero. A vertical line has no slope.
  • Incorrectly simplifying fractions: Slope can be a fraction; reduce it if needed, but a decimal is also fine.
  • Using the y-intercept formula incorrectly: The y-intercept b = yâ‚� – m·xâ‚�, not yâ‚� + m·xâ‚�.

Always double-check your coordinates and the order. A simple sign error changes the slope from positive to negative.

Limits of the Slope Formula

The slope formula only works for straight lines. If you have a curve, the slope changes at every point, and you need calculus (derivatives) to find the instantaneous slope. Also, the formula assumes the coordinates are real numbers; it does not handle complex numbers. For vertical lines, the slope is undefined, but the line still exists—you just can’t express it in slope-intercept form. In that case, the equation is x = constant.

Another limit: the slope alone does not tell you the y-intercept. You need at least one point to find the full equation. That’s why the calculator also computes b.

Frequently Asked Questions

What is the slope of a horizontal line?
The slope of a horizontal line is 0. The rise is 0 because y never changes, so m = 0 / run = 0.

What is the slope of a vertical line?
The slope is undefined. The run is 0 because x never changes, so you cannot divide by zero. The equation is x = a constant.

Can slope be a fraction?
Yes. For example, if the rise is 2 and the run is 3, the slope is 2/3. That means for every 3 units you move right, you move up 2 units.

How do I find the y-intercept from two points?
Once you have the slope m, plug one point into y = mx + b and solve for b. For instance, if m = 2 and the point is (1, 2), then 2 = 2(1) + b, so b = 0.

What is the difference between slope and gradient?
In most contexts, they are the same. In mathematics, gradient is a broader term for multivariable functions, but for a straight line, slope and gradient are interchangeable.

Does the slope change if I swap the two points?
No, the slope stays the same. If you swap, you get (yâ‚� – yâ‚‚)/(xâ‚� – xâ‚‚), which is the same as (yâ‚‚ – yâ‚�)/(xâ‚‚ – xâ‚�) because both numerator and denominator change sign.

Related

Formula used
in x1 | x� | - | 1 | 0
in y1 | y� | - | 2 | 0
in x2 | xâ‚‚ | - | 4 | 0
in y2 | yâ‚‚ | - | 8 | 0
out slope | Slope (m) | - | (y2 - y1) / (x2 - x1) | 4
out rise | Rise (y₂ - y�) | - | y2 - y1 | 2
out run | Run (x₂ - x�) | - | x2 - x1 | 2
out equation | Equation | - | "y = " + (y2 - y1) / (x2 - x1) + "x + " + (y1 - (y2 - y1) / (x2 - x1) * x1) | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.