The slope of a line measures how steep it is: how much it rises (or falls) for each unit you move to the right. Give this slope calculator two points and and it returns the slope , the same slope as an exact fraction, the angle the line makes with the x-axis, the percent grade, the y-intercept and the equation of the line in slope-intercept form and in standard form.
As a bonus you also get the distance between the two points and the midpoint of the segment that joins them. Each result comes with the working, so you can check homework, prepare a lesson or verify a design drawing line by line.
Two points on the same vertical line are handled properly: the slope is reported as undefined and the equation is given as , instead of an error or a meaningless huge number.
How to use this calculator
- Enter the coordinates of the first point, and .
- Enter the coordinates of the second point, and . Order does not matter: swapping the points gives the same slope.
- Read the slope and the equation of the line. With whole-number coordinates the slope is also shown as a reduced fraction, and the equation uses exact fractions.
- Use the angle or the grade for ramps, roofs, roads and terrain; use the standard form for systems of equations.
- Open the steps to see each subtraction and division.
The formula
The slope is the rise over the run:
The y-intercept follows from either point: , which gives the slope-intercept form . Multiplying through by the run gives the integer standard form .
The angle of inclination is , and the grade is the slope as a percentage, %. The distance between the points comes from Pythagoras, , and the midpoint is .
If the run is zero, the line is vertical and the slope is undefined; its equation is .
Worked example
Find the line through and .
- Rise and run: and .
- Slope: .
- Intercept: , so the line is y = (1/2)x + 2, or in standard form x − 2y = −4.
- Angle: ; grade: 50%.
- Distance: .
A road that climbs 8 m over 100 m of horizontal distance has slope 0.08, a grade of 8% and an angle of only 4.57°.
Reading a slope
| Slope | Line | Angle |
|---|---|---|
| Rises from left to right | Between 0° and 90° | |
| Horizontal | 0° | |
| Falls from left to right | Between 0° and −90° | |
| Undefined | Vertical | 90° |
Two non-vertical lines are parallel when their slopes are equal, and perpendicular when the product of their slopes is : a line of slope 2 is perpendicular to one of slope .
Slope as a percentage, an angle or a ratio
Engineers, builders and hikers express the same steepness in different ways. A grade of 100% is not vertical: it is a 45° slope, where the rise equals the run. Accessible ramps are often limited to a 1:12 ratio — about 8.33% or 4.76° — and roof pitches are quoted as rise per 12 units of run in the US. To convert, use and .
In mathematics and physics, slope is also the rate of change: on a distance–time graph it is a speed, and on a cost–quantity graph it is the cost per unit. For curves rather than lines, see the quadratic formula calculator.
Frequently asked questions
How do you find the slope from two points?
Subtract the y-coordinates and the x-coordinates in the same order, then divide: m = (y₂ − y₁) / (x₂ − x₁). For (1, 3) and (5, 11), m = 8 / 4 = 2.
What is an undefined slope?
When both points have the same x-coordinate, the run is 0 and the division is impossible. The line is vertical, its equation is x = constant, and its slope is undefined — not zero and not infinite.
What is the difference between a zero slope and an undefined slope?
A zero slope means the line is horizontal (no rise at all), with an equation y = constant. An undefined slope means the line is vertical (no run), with an equation x = constant.
How do I convert a slope to degrees or percent?
Percent grade is the slope times 100. The angle in degrees is the arctangent of the slope. A slope of 0.5 is a 50% grade and about 26.57°; a slope of 1 is a 100% grade and exactly 45°.
Is "gradient" the same as slope?
Yes. In British and many international curricula the slope of a straight line is called its gradient. It is also written as rise over run, or Δy/Δx.
Sources
- OpenStax, College Algebra 2e — §2.2 Linear Equations in One Variable (slope and equations of lines)
- OpenStax, College Algebra 2e — §2.1 The Rectangular Coordinate Systems and Graphs (distance and midpoint)
- Weisstein, Slope — Wolfram MathWorld
Last updated: