Slope of a Line Calculator
Slope is the single number that captures how steep a line is and which way it tilts, and it sits at the heart of algebra, calculus and any field that fits lines to data. This calculator finds the slope between two points for you. Enter the first point as x1 and y1 and the second as x2 and y2, and the tool computes the rise (the change in y) and the run (the change in x), then divides rise by run to give the slope. Slope is exactly rise over run: it tells you how many units the line moves up or down for every unit it moves to the right. A positive slope rises from left to right, a negative slope falls, a slope of zero is a flat line, and a vertical line (where the run is zero) has an undefined slope, which the calculator flags rather than dividing by zero. The order of the points does not matter as long as you keep it consistent. Use it to check homework, find the gradient of a trend line, or set up a line equation. Every figure is computed deterministically from the formula shown below, with a worked example that reconciles exactly to the calculator's defaults.
Slope is the rise over the run between two points: m = (y2 - y1) / (x2 - x1). From point (1, 2) to point (4, 8), the rise is 6 and the run is 3, giving a slope of 2.00.
Slope formula
m = ( y2 - y1 ) / ( x2 - x1 )
rise = y2 - y1 (vertical change)
run = x2 - x1 (horizontal change)
slope is undefined when the run is zero (a vertical line)
Subtract to find the rise and the run, then divide rise by run. The result is the slope, the rate at which y changes for each unit of x.
Worked example
Find the slope of the line through the points (1, 2) and (4, 8).
- Rise = y2 - y1 = 8 - 2 = 6
- Run = x2 - x1 = 4 - 1 = 3
- Slope = rise / run = 6 / 3 = 2.00
The slope is 2.00, meaning y rises by 2 for every 1 unit x moves right. These are the calculator's default inputs, so the result above matches the widget exactly.
Slope for sample point pairs
Slope of the line through a few point pairs.
| Point 1 | Point 2 | Slope |
|---|---|---|
| (1, 2) | (4, 8) | 2.00 |
| (0, 0) | (5, 5) | 1.00 |
| (2, 6) | (6, 2) | -1.00 |
| (1, 4) | (7, 4) | 0.00 |
A vertical line has an undefined slope because the run is zero.
Slope calculator: frequently asked questions
What is the slope of a line?
Slope measures how steep a line is and in which direction it tilts. It is the change in y (the rise) divided by the change in x (the run) between two points on the line: m = (y2 minus y1) divided by (x2 minus x1). A slope of 2 means y increases by 2 for every 1 it moves right. Positive slopes rise to the right, negative slopes fall.
What does rise over run mean?
Rise is the vertical change between two points, y2 minus y1. Run is the horizontal change, x2 minus x1. Slope is rise divided by run, so it tells you how many units the line goes up or down for each unit it moves to the right. This is the standard definition of slope in coordinate geometry.
What if the run is zero?
If x2 equals x1, the run is zero and the line is vertical. Division by zero is undefined, so a vertical line has no defined slope; it is described as undefined or infinite. The calculator flags this case rather than returning a number. A horizontal line, where the rise is zero, has a slope of exactly zero.
Does a positive or negative slope mean anything?
Yes. A positive slope means the line rises from left to right: as x increases, y increases. A negative slope means it falls: as x increases, y decreases. A slope of zero is a flat horizontal line. The larger the absolute value of the slope, the steeper the line.
Does the order of the points matter?
No, as long as you keep the order consistent in the numerator and denominator. Computing (y2 minus y1) over (x2 minus x1) gives the same slope as (y1 minus y2) over (x1 minus x2), because both signs flip together. Just do not mix the orders between top and bottom, or you will get the wrong sign.
Official sources
- Mathematical functions and reference formulas: US National Institute of Standards and Technology (NIST). As at 25 June 2026.
Reviewed by the CalculatorHub team, edited by James Graham, 25 June 2026. See our methodology. This is general information, not financial, tax, legal or investment advice.