Slope between two points
Calculate the slope of a line from two points (x1, y1) and (x2, y2). Also shows the rise, the run, and the line's angle of inclination.
- Rise (Δy)
- 6
- Run (Δx)
- 3
- Angle of inclination
- 63.43 °
Slope is undefined when x1 = x2 (a vertical line). The angle of inclination is shown in degrees.
What the Slope Calculator Does
This Slope Calculator finds the slope (also called the gradient) of a straight line that passes through two points. You enter the coordinates of the first point (x1, y1) and the second point (x2, y2), and the tool returns the slope as a single number, often along with the line's angle and equation.
It is useful for algebra and geometry students checking homework, engineers and surveyors working out grades, and anyone in construction, roofing, or drainage who needs to express steepness as a ratio or percentage.
How Slope Is Calculated: The Formula
Slope measures how much a line rises (or falls) for each unit it moves sideways. It is the ratio of the vertical change to the horizontal change between two points, commonly summarized as "rise over run."
The formula is:
m = (y2 - y1) / (x2 - x1)
A positive m means the line goes up from left to right; a negative m means it goes down. A slope of 0 is a perfectly flat horizontal line. When x1 equals x2, the run is zero, so you would be dividing by zero. The slope is undefined in that case because the line is vertical.
Worked Example with Real Numbers
Suppose a line passes through the points (2, 3) and (6, 11). Label them so x1 = 2, y1 = 3, x2 = 6, and y2 = 11.
Apply the formula: m = (11 - 3) / (6 - 2) = 8 / 4 = 2.
The slope is 2, meaning the line rises 2 units vertically for every 1 unit it moves to the right. To express this as a percent grade, multiply by 100: a slope of 2 equals a 200% grade. To find the angle, take the inverse tangent: arctan(2) is about 63.4 degrees from horizontal.
Tips, Common Mistakes, and Factors That Affect the Result
The math is simple, but a few errors trip people up. Keep the order of subtraction consistent, and double-check which value is the rise and which is the run.
- Keep the points in the same order top and bottom. Subtract y1 from y2 and x1 from x2 in the same direction; mixing them flips the sign.
- Do not divide the run by the rise. Slope is rise over run (change in y over change in x), not the reverse.
- Watch negative coordinates. Subtracting a negative number adds, so (y2 - (-4)) becomes (y2 + 4).
- Check for a vertical line. If x1 = x2 the slope is undefined, not zero. A zero slope is a horizontal line where y1 = y2.
- Picking the two points in reverse order does not change the answer, because both the numerator and denominator change sign and the ratio stays the same.
Reading the Result and Related Outputs
Once you have the slope, you can describe the line in several ways. Using point-slope form, the line through (2, 3) with slope 2 is y - 3 = 2(x - 2), which simplifies to slope-intercept form y = 2x - 1, where -1 is the y-intercept.
The same slope value can be reported as a fraction, a decimal, a percent grade, or an angle in degrees, depending on your field. A road designer may prefer a percent grade, while a math student usually wants the fraction or decimal.
Frequently asked questions
How is slope calculated?
Slope (m) equals the change in y divided by the change in x: m = (y2 − y1) / (x2 − x1). It measures how steeply the line rises or falls.
What does a negative slope mean?
A negative slope means the line goes down from left to right — as x increases, y decreases. A positive slope rises from left to right.
Why can the slope be undefined?
If x1 equals x2 the run is zero, so the line is vertical and the slope is undefined (division by zero). Choose two points with different x values.
What is the angle of inclination?
It is the angle the line makes with the positive x-axis, computed as arctan of the slope. A 45° angle corresponds to a slope of 1.