Slope Calculator
Turn two points, or a rise and a run, into the dimensionless ratio m = rise/run; the page also reports the inclination from the positive x-axis, and it labels a vertical line undefined instead of Infinity.
How to use
- Choose two-point mode when you have (x₁, y₁) and (x₂, y₂), or rise-and-run when you already know the vertical change and the horizontal change.
- Enter the pair. A zero run (same x, or run = 0) is a vertical line: the slope is reported as undefined, with a 90° angle from the +x-axis.
- Read m as the primary result. The extra angle is arctan(m) in degrees — a companion figure, not a replacement for rise/run and not a compass bearing.
- If you wanted the length of the segment instead, use the distance calculator. Two identical points do not determine a line and are rejected.
How it works
Slope is how much y changes per unit of x: m = (y₂ − y₁) / (x₂ − x₁), or rise/run when those two increments are already named. From (1, 2) to (3, 6) the rise is 4 and the run is 2, so m = 2. The ratio is dimensionless when both increments use the same length unit, which is why this form has no unit picker. A horizontal line has m = 0. A vertical line has run 0, so m is not a real number; the page prints “Undefined (vertical line)” rather than Infinity.
Roofs, ramps and graphs all quote this ratio. A wheelchair ramp’s rise and run are building-code numbers; m = rise/run is the figure this page returns (a 1:12 run is m = 1/12). A plotted line through two data points uses the two-point form. Road “grade” is often 100×m percent; this calculator does not multiply by 100 for you.
Because the tool also computes an angle, it is easy to treat the page as an angle calculator. The angle is arctan(m) from the positive x-axis, or 90° when the line is vertical. A slope of 1 is 45°. That angle is not an azimuth from north, not a roof pitch expressed as “X in 12,” and not the complementary angle inside a right triangle unless your axes happen to match that drawing.
This is not the distance between the same two points — that length is √(run² + rise²) on the distance page. It is not Pythagoras for a missing side, and it is not a triangle solver. Two coincident points are not a line. A rise of 0 with a non-zero run is a flat line (m = 0), which is valid.
Sign matters: a negative rise over a positive run is a downward slant (negative m and a negative angle from +x). Swapping the two points flips both rise and run and leaves m unchanged.
Formula
m = (y₂ − y₁) / (x₂ − x₁) m = rise / run θ = arctan(m)
Worked examples
Two points
(1, 2) to (3, 6) → slope 2
A vertical line
(2, 1) to (2, 8) → undefined (vertical)
Useful notes
- Coordinates are unitless here — only their ratio matters.
- For the distance between the same two points, use the distance calculator.
- Vertical lines are labelled undefined; the companion angle in that case is 90°.
- Grade as a percent is 100 × m and is not applied automatically.
- Two identical points are rejected because they do not determine a line.
FAQ
- How do I find the slope of a line?
Subtract the y-coordinates and divide by the difference of the x-coordinates. From (1, 2) to (3, 6) the slope is 4/2 = 2.
- What is the slope of a vertical line?
It is undefined. Division by zero is not a number, so this tool does not show Infinity.
- Is slope the same as the angle?
No. Slope is rise/run. The angle is arctan of that ratio, measured from the positive x-axis.
- Does a slope of 1 mean 45 degrees?
Yes. arctan(1) is 45° from the positive x-axis. That is not a compass bearing and not a “rise in 12” roof mark.
- What if my two points are the same?
They do not determine a line, so the calculator returns no result. You need two distinct points, or a rise and run that are not both zero.
Related tools
Distance Calculator
Find the straight-line distance between two points in a plane or in 3-D space.
Pythagorean Theorem
Find the hypotenuse from two legs, or a missing leg from the hypotenuse and the other leg.
Right Triangle
From two legs, or a leg and the hypotenuse, get the third side, both acute angles, area and perimeter.
Triangle Calculator
Find a triangle’s area, perimeter and angles from three sides, or the area from base and height or SAS.
See all Geometry tools.