Free tool · Math and study
Slope calculator
Enter two points and get the slope of the line through them as a fraction and a decimal, with the rise, the run, the angle and the equation of the line.
- Free
- No sign-up
- Runs in your browser
3/2Slope of the line through (1, 2) and (5, 8), which is 1.5 as a decimal.
- Rises to the right
- Rise 6
- Run 4
- Angle 56.3099°
- Slope (decimal)
- 1.5
- Slope as a percent
- 150%
- Angle with the x-axis
- 56.309932°
- y = mx + b
- y = 1.5x + 0.5
- With fractions
- y = (3/2)x + 1/2
- Point-slope form
- y − 2 = 1.5(x − 1)
- y-intercept (b)
- 1/2 ≈ 0.5
- x-intercept
- -1/3 ≈ -0.33333
- Distance between points
- 7.211102551
- Midpoint
- (3, 5)
- Parallel lines
- Slope 3/2
- Right-angle lines
- Slope -2/3
| Step | What happens |
|---|---|
| 1 | Rise = y2 − y1 = 8 − 2 = 6. |
| 2 | Run = x2 − x1 = 5 − 1 = 4. |
| 3 | Slope = rise ÷ run = 6 ÷ 4 = 3/2 (about 1.5). |
| 4 | Find b by putting the first point into y = mx + b: b = 2 − (1.5 × 1) = 0.5. |
| 5 | The line is y = 1.5x + 0.5. |
Distance squared is 52, so the distance is its square root, 7.211102551.
How to use the Slope Calculator
- Type the first point into x1 and y1.
- Type the second point into x2 and y2. Negatives and decimals work.
- Read the big slope value, then the chips for rise, run and direction.
- Check the cards for the angle, the line equation and the distance, and follow The working table step by step.
How do I find the slope of a line?
Slope tells you how steep a line is. Subtract the first y from the second y to get the rise. Subtract the first x from the second x to get the run. Then divide the rise by the run. For the points (1, 2) and (5, 8), the rise is 6 and the run is 4, so the slope is 6/4, which simplifies to 3/2, or 1.5 as a decimal. The line climbs 1.5 units for every 1 unit it moves right.
Which point you call first does not matter, as long as you use the same order for both subtractions. If you swap the points, the rise and the run both change sign, and the slope comes out the same.
The calculator keeps the answer as an exact fraction. Dividing 1 by 3 gives 1/3, shown as a fraction because the decimal would never end. It also gives the rounded decimal, so you can use whichever form your homework asks for.
What does a positive, negative, zero or undefined slope mean?
A positive slope means the line goes up as you read from left to right, like 3/2 above. A negative slope means it goes down: the points (0, 5) and (5, 0) give -1. The bigger the number, ignoring the sign, the steeper the line.
A flat line has a rise of 0, so its slope is 0. Take (1, 4) and (6, 4): the equation is y = 4. A straight up-and-down line has a run of 0, and nobody can divide by 0, so its slope is called undefined. The points (3, 1) and (3, 9) give the line x = 3. The calculator tells you plainly when this happens.
Slope can also be written as an angle or a percent. The angle is the one the line makes with a flat line, found with the inverse tangent of the slope. The percent is the slope times 100: it says how many units the line rises for every 100 units across. Both are in the cards under the answer.
| Slope | Angle | As a percent | Perpendicular slope |
|---|---|---|---|
| 0 | 0° | 0% | A vertical line, slope undefined |
| 1 | 45° | 100% | -1 |
| 2 | 63.43° | 200% | -1/2 |
| 3 | 71.57° | 300% | -1/3 |
| 5 | 78.69° | 500% | -1/5 |
| -1 | -45° | -100% | 1 |
| -2 | -63.43° | -200% | 1/2 |
How do I write the equation of the line?
The usual form is y = mx + b, where m is the slope and b is the height at which the line crosses the y axis. After finding the slope, put one of your points into the equation and solve for b. For the first example, b = 2 − 1.5 × 1 = 0.5, so the line is y = 1.5x + 0.5. The calculator also writes it with fractions, y = (3/2)x + 1/2, when that is neater.
Point-slope form keeps one of your points in plain sight: y − 2 = 1.5(x − 1). It gives the same line, just not yet tidied. Setting y to 0 in the equation finds where the line crosses the x axis. For this line that is x = -1/3.
Two lines with the same slope never meet, so a line parallel to this one also has slope 3/2. A line at a right angle to it has the negative reciprocal slope, -2/3: flip the fraction and change its sign.
How far apart are the two points?
The distance between the points is the length of the slanted side of a right triangle with the rise and the run as its other two sides. For the first example, 4² + 6² = 52, so the distance is the square root of 52, about 7.211102551. The midpoint, the point halfway along, is (3, 5).
To work out a missing side of a right triangle from any two sides, use the Pythagorean theorem calculator. For slopes written as fractions, the fraction calculator adds and compares them, and the percentage calculator helps when a grade is given as a percent.
Use it with
- Pythagorean Theorem Calculator: find a missing side.
- Fraction Calculator: add, subtract, multiply, divide fractions with steps.
- Percentage Calculator: x% of Y, % change, % difference.
Questions
What is the formula for slope?
Slope = (y2 − y1) ÷ (x2 − x1), the rise over the run. For (1, 2) and (5, 8) it is 6/4 = 3/2.
What is the slope of a horizontal line?
Zero. The y values stay the same, so the rise is 0. For example, y = 4 has slope 0.
Why is the slope of a vertical line undefined?
All its points share the same x, so the run is 0, and a division by 0 has no answer. A vertical line is written x = 3.
Does the order of the points matter?
No. Swapping them flips the sign of both the rise and the run, and the slope stays the same.
How do I find the slope from an equation?
Write the equation as y = mx + b. The number in front of x is the slope. In y = 1.5x + 0.5, the slope is 1.5.
How do I turn a slope into an angle?
Take the inverse tangent of the slope. A slope of 3/2 gives 56.31° above flat.
The tool's results are computed in your browser by the code on this page; the explanations are checked against the tool's own output.