Slope Calculator
Find slope from two points, or a line from a point and slope or angle: angle, percent grade, distance, midpoint, and the equation in three forms with a graph.
The interactive tool loads here when JavaScript runs.
About this toolWhat is the Slope Calculator?
Slope measures how steep a line is: the change in y divided by the change in x, often remembered as rise over run. This slope calculator takes two points and returns the slope, the angle the line makes with the x-axis, the percent grade, the distance between the points, the midpoint, both intercepts, the perpendicular slope and the equation of the line in slope-intercept, point-slope and standard form. A small graph plots the line and the points.
Two other modes start from what you might have instead of a second point: a point and a slope, or a point and an angle in degrees. Both can also find the two points a given distance along the line, which helps when laying out a path or a cut at a fixed length.
Coordinates and slopes can be typed as decimals or fractions. When every input is a rational number the arithmetic is exact, so (1, 2) and (4, 7) give a slope of 5/3 rather than 1.666667, and the standard form comes out with whole-number coefficients: 5x − 3y = −1.
- Two points, point and slope, or point and angle
- Slope, angle, percent grade, distance, midpoint and both intercepts
- Slope-intercept, point-slope and integer standard form
- Exact fraction arithmetic for rational inputs
- Perpendicular slope and points at a given distance
- Live graph, copy and share link
How to use the Slope Calculator
- Choose what you know: two points, a point and a slope, or a point and an angle.
- Enter the coordinates. Fractions such as 3/4 and negative numbers are fine.
- For point modes, optionally enter a distance to get the two points that far along the line.
- Read the slope, angle, grade, distance, midpoint, intercepts and the three equation forms.
- Check the graph, then copy the results or share a link.
Worked examples
Two points with a fractional slope
Input
(1, 2) and (4, 7)
Output
m = 5/3 ≈ 1.66667; angle 59.0362°; grade 166.667%; distance 5.83095; midpoint (2.5, 4.5); y = (5/3)x + 1/3; 5x − 3y = −1
Rise 5 over run 3. Exact arithmetic keeps the intercept as 1/3 and gives an integer standard form.
Wheelchair ramp check
Input
(0, 0) and (12, 1), in feet
Output
m = 1/12; grade 8.33333%; angle 4.76364°; ramp length 12.0416 ft
One foot of rise over 12 ft of run is exactly the ADA maximum running slope. The sloped surface is slightly longer than the run.
Point, negative slope and a distance
Input
Point (2, −1), slope −1/2, distance 5
Output
y = −(1/2)x; x + 2y = 0; angle −26.5651°; perpendicular slope 2
The line passes through the origin, so the y-intercept is 0. The two points 5 units away lie in opposite directions along the line.
Background and insight
The slope formula m = (y₂ − y₁) / (x₂ − x₁) breaks down when x₂ = x₁. That line is vertical and its slope is undefined, not infinite in any usable sense, so the calculator reports it as x = constant and skips the slope-intercept form, which cannot describe it. A horizontal line has slope 0 and no x-intercept unless it lies on the axis.
Slope, angle and grade are three views of the same number. The angle is arctan(m), and the percent grade is 100·m. They are not proportional: a 100% grade is 45°, not 90°. Road signs use percent grade, roofers use rise per 12 units of run (a 4-in-12 roof has a slope of 1/3 and an angle of 18.43°), and accessibility codes use ratios. The 2010 ADA Standards for Accessible Design set a maximum ramp running slope of 1:12, which is an 8.33% grade, or 4.76°.
Two non-vertical lines are perpendicular when their slopes multiply to −1, so the perpendicular slope is the negative reciprocal −1/m. Parallel lines share a slope. The distance between two points is the Pythagorean theorem applied to the run and rise, √(Δx² + Δy²).
Common use cases
Algebra homework
Get the line through two points in every form a worksheet might ask for, with fractions kept exact.
Ramps, driveways and drainage
Turn a measured rise and run into a percent grade and angle to compare against a code limit or a minimum fall for drainage.
Roof pitch
Enter the rise over 12 units of run to see the roof angle in degrees for a saw or a solar mount.
Data and charts
Find the rate of change between two readings, such as cost per unit or temperature change per hour.
Tips and limitations
- The order of the points does not change the slope, only the signs of rise and run together.
- Percent grade is not degrees. Steep roads around 10% are under 6°.
- A vertical line has no slope-intercept form; the calculator gives x = constant instead.
- Type fractions as 2/3 rather than 0.667 to keep the equation exact.
- For a line of best fit through many points, use a regression tool; this one works with two points or one point and a direction.
Frequently asked questions
How do you find the slope between two points?
Subtract the y-values and divide by the difference of the x-values in the same order: m = (y₂ − y₁) / (x₂ − x₁). For (1, 2) and (4, 7) that is 5 / 3. If the x-values are equal the line is vertical and the slope is undefined.
How do I convert slope to an angle in degrees?
Take the arctangent: angle = arctan(m). A slope of 1 is 45°, a slope of 1/12 is 4.76°, and a slope of 5/3 is 59.04°. Negative slopes give negative angles, meaning the line falls from left to right.
What is the difference between slope and percent grade?
They are the same ratio in different dress. Percent grade is the slope times 100, so a slope of 0.06 is a 6% grade. Neither is the angle: a 6% grade is about 3.43°.
How do I write the equation of a line from two points?
Find the slope m, then the y-intercept b = y₁ − m·x₁, and write y = mx + b. For (1, 2) and (4, 7), m = 5/3 and b = 1/3, so y = (5/3)x + 1/3, which in standard form is 5x − 3y = −1.
What is the slope of a perpendicular line?
The negative reciprocal, −1/m. A line with slope 2 is perpendicular to one with slope −1/2. A horizontal line (slope 0) is perpendicular to a vertical line, whose slope is undefined.
What slope is allowed for a wheelchair ramp?
Under the 2010 ADA Standards the maximum running slope of a ramp is 1:12, which is a grade of 8.33% or about 4.76°. Local codes can be stricter, and long ramps also need level landings.
Is there an in-depth guide to the Slope Calculator?
Yes. “Solving Triangles and Slopes: Sines, Cosines and Rise Over Run” covers the background, how it works, common pitfalls and worked examples. Read the full guide.
Related Tools You May Like
Free, in-browser tools that pair well with this one.