Gradient of a Line Calculator

Published on: November 19, 2026
Final Answer: Free | Full Steps: Plus

This Gradient of a Line Calculator finds how steep a straight line is from two points on it, and shows the working line by line. The gradient is the rise, the change in y, divided by the run, the change in x. The answer is simplified and given as a fraction and a decimal. A positive gradient goes up from left to right, a negative one goes down, 0 is flat, and a vertical line has no gradient.

run rise (x₁, y₁) (x₂, y₂)

In the diagram, the rise is how far the line goes up between the two points and the run is how far it goes across.

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Substitute the two pairs of coordinates into the formula.
  4. Work out the gradient.

Formula: Gradient Formula

This formula gives how steep a line is. Divide the change in y, the rise, by the change in x, the run.

\(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\)

Required knowledge

The worked examples below go through the same pattern from start to finish, so you can compare every step with your own working. For more practice, the notes page goes further with extra worked examples and fuller explanations of the ideas behind each step. Use them together to check your answers and to understand why each step works.

See Example 1 Hide Example 1

Problem

\((x_{1}, y_{1}) = (1, 2), (x_{2}, y_{2}) = (5, 4)\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Substitute the two pairs of coordinates into the formula.
  4. Work out the gradient.

Formula

Formula: Gradient Formula

This formula gives how steep a line is. Divide the change in y, the rise, by the change in x, the run.

\(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\)

Step 1

Step 1 - Set up the problem.

In this problem: We are finding the gradient of the straight line through the points \((1, 2)\) and \((5, 4)\).

\((x_{1}, y_{1}) = (1, 2),\; (x_{2}, y_{2}) = (5, 4)\)
run rise (1, 2) (5, 4)

Step 2

Step 2 - Write the formula.

In this problem: The gradient says how steep a line is: how far it goes up, the rise, for every step it goes across, the run. The rise is the change in \(y\) and the run is the change in \(x\), so the gradient is the rise divided by the run.

\(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\)

Step 3

Step 3 - Substitute the two pairs of coordinates into the formula.

In this problem: Replacing \(x_{1}\), \(y_{1}\), \(x_{2}\) and \(y_{2}\) with \(1\), \(2\), \(5\) and \(4\) in \(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\) gives \(m = \frac{4 - 2}{5 - 1}\).

\(m = \frac{4 - 2}{5 - 1}\)

Step 4

Step 4 - Work out the gradient.

In this problem: The rise is \(4 - 2 = 2\) and the run is \(5 - 1 = 4\). \(\frac{2}{4}\) simplifies to \(\frac{1}{2}\) by dividing the top and the bottom by \(2\). As a decimal, \(\frac{1}{2} = 0.5\). The gradient is positive, so the line goes up from left to right.

\(\begin{aligned} m &= \frac{4 - 2}{5 - 1} \\[8pt] &= \frac{2}{4} \\[8pt] &= \frac{1}{2} \\[8pt] &= 0.5 \end{aligned}\)

Final Answer

\(m = \frac{1}{2} = 0.5\)
See Example 2 Hide Example 2

Problem

\((x_{1}, y_{1}) = (-3, 1), (x_{2}, y_{2}) = (3, -2)\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Substitute the two pairs of coordinates into the formula.
  4. Work out the gradient.

Formula

Formula: Gradient Formula

This formula gives how steep a line is. Divide the change in y, the rise, by the change in x, the run.

\(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\)

Step 1

Step 1 - Set up the problem.

In this problem: We are finding the gradient of the straight line through the points \((-3, 1)\) and \((3, -2)\).

\((x_{1}, y_{1}) = (-3, 1),\; (x_{2}, y_{2}) = (3, -2)\)
run rise (−3, 1) (3, −2)

Step 2

Step 2 - Write the formula.

In this problem: The gradient says how steep a line is: how far it goes up, the rise, for every step it goes across, the run. The rise is the change in \(y\) and the run is the change in \(x\), so the gradient is the rise divided by the run.

\(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\)

Step 3

Step 3 - Substitute the two pairs of coordinates into the formula.

In this problem: Replacing \(x_{1}\), \(y_{1}\), \(x_{2}\) and \(y_{2}\) with \(-3\), \(1\), \(3\) and \(-2\) in \(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\) gives \(m = \frac{-2 - 1}{3 - \left(-3\right)}\).

\(m = \frac{-2 - 1}{3 - \left(-3\right)}\)

Step 4

Step 4 - Work out the gradient.

In this problem: The rise is \(-2 - 1 = -3\) and the run is \(3 - \left(-3\right) = 6\). \(\frac{-3}{6}\) simplifies to \(-\frac{1}{2}\) by dividing the top and the bottom by \(3\). As a decimal, \(-\frac{1}{2} = -0.5\). The gradient is negative, so the line goes down from left to right.

\(\begin{aligned} m &= \frac{-2 - 1}{3 - \left(-3\right)} \\[8pt] &= \frac{-3}{6} \\[8pt] &= -\frac{1}{2} \\[8pt] &= -0.5 \end{aligned}\)

Final Answer

\(m = -\frac{1}{2} = -0.5\)
run rise (x₁, y₁) (x₂, y₂)

Example Problems

Click one to load it into the box and solve it.