ThisCalculator

Math

Calculate Slope: Formula, Examples, and Calculator

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.

Calculate Slope: Formula, Examples, and Calculator

The slope calculator finds how steep a straight line is from two points: enter the x- and y-coordinates of each point, and it returns the line’s slope. Slope is the change in y divided by the change in x, so the answer describes both the line’s direction and its rate of change.

Formula

The slope formula is m = (y₂ − y₁) / (x₂ − x₁), often described as “rise over run.” Here, m is the slope, while (x₁, y₁) and (x₂, y₂) are the coordinates of two points on the line. The numerator, y₂ − y₁, is the change in y; the denominator, x₂ − x₁, is the change in x. Coordinates are measured in their respective units, and slope has units of y divided by units of x. If both axes use the same unit, those units cancel and slope is often reported as a number.

Worked Example

Using the calculator’s default points, (x₁, y₁) = (0, 0) and (x₂, y₂) = (2, 3):

  1. Find the change in y: 3 − 0 = 3.
  2. Find the change in x: 2 − 0 = 2.
  3. Divide: m = 3 / 2 = 1.50.

The slope is 1.50. In this example, y increases by 1.5 units for every 1-unit increase in x.

How to Calculate Slope from Two Points

Use any two distinct points that lie on the same straight line. Keep each x-coordinate paired with its y-coordinate, then subtract in the same order in both parts of the formula. For example, use (x₂ − x₁) below the fraction bar if you use (y₂ − y₁) above it.

  • Choose the first point and label it (x₁, y₁).
  • Label the other point (x₂, y₂).
  • Subtract the y-coordinates to find the vertical change.
  • Subtract the x-coordinates to find the horizontal change.
  • Divide the vertical change by the horizontal change and include units if they are relevant.

The order of the points does not change the result when used consistently. Reversing both differences changes the numerator and denominator signs, which cancel. Reversing only one difference produces the wrong sign.

What the Slope Tells You

A line’s slope conveys direction as well as steepness. A positive slope rises from left to right; a negative slope falls from left to right. A slope of zero describes a horizontal line: y stays constant as x changes. The larger the absolute value of a slope, the more y changes per unit of x.

For instance, a slope of −2 means y decreases by 2 units whenever x increases by 1 unit. A slope of 0.5 means y increases by half a unit for each 1-unit increase in x. These interpretations assume x is moving in the positive direction.

Slope is not the same as the angle of a line. If the angle θ is measured from the positive x-axis, then m = tan(θ); conversely, θ = arctan(m). This angle is commonly expressed in degrees, but slope itself is a rate, not an angle.

Slope from a Graph, Equation, or Table

On a graph, choose two points whose coordinates can be read accurately, then apply the same formula. The vertical movement is the rise and the horizontal movement is the run. Count grid intervals rather than estimating the visual steepness: a distorted aspect ratio or unequal axis scales can make a line look steeper or flatter than its numerical slope.

In the slope-intercept equation y = mx + b, the coefficient of x is the slope, m, and b is the y-intercept. For an equation in standard form, such as Ax + By = C, solve for y when B is not zero: y = (−A/B)x + C/B, so the slope is −A/B. A table of values can also provide two points; if the data are intended to lie on a straight line, compare the change in y with the change in x.

Vertical Lines, Units, and Common Errors

If x₂ equals x₁, the denominator is zero. A vertical line therefore has an undefined slope; its slope is not zero or infinity as a numerical answer. A horizontal line, by contrast, has zero slope because its y-coordinates do not change.

Pay attention to units when axes use different measurements. If y is distance in feet and x is time in seconds, slope is measured in feet per second. To express that same rate in metric units, convert the measurements consistently; do not mix feet with meters or seconds with minutes without converting. When both axes show the same kind of quantity, a slope may be dimensionless, but it can still represent a meaningful ratio.

  • Swapping coordinates: A point is written (x, y), not (y, x).
  • Changing subtraction order: Use the same point order in both differences.
  • Rounding too early: Keep full values during calculation, then round the final result to suitable precision.
  • Using points from a curve: The formula gives the slope of the secant between two points. A curve’s slope can vary, so two points do not generally give one slope for the entire curve.

Frequently Asked Questions

What is the easiest way to calculate slope?
Take the difference between the y-coordinates and divide it by the difference between the x-coordinates: (y₂ − y₁)/(x₂ − x₁). Keep the subtraction order consistent.

Can slope be negative?
Yes. A negative slope means y decreases as x increases. The sign indicates direction; the absolute value indicates steepness in coordinate units.

What is the slope of a horizontal line?
It is zero. Any two points on a horizontal line have the same y-coordinate, making the numerator zero.

Why is the slope of a vertical line undefined?
Its two points have the same x-coordinate, so the run is zero. Division by zero is undefined.

Does it matter which point I call first?
No, provided the order is consistent. Reversing both point differences leaves the quotient unchanged.

How do I find slope from y = mx + b?
The coefficient multiplying x is m, the slope. For example, y = −3x + 4 has slope −3.

Related

Formula used
in x1 | First point x-coordinate | - | 0 | 
in y1 | First point y-coordinate | - | 0 | 
in x2 | Second point x-coordinate | - | 2 | 
in y2 | Second point y-coordinate | - | 3 | 
out slope | Slope | - | (y2 - y1) / (x2 - 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.