Slope Calculator
Enter two points to find the slope of the line through them, along with its equation, angle, the distance between the points and their midpoint.
Last updated October 20, 2026
Result
Slope = 2
| Rise | 4 |
|---|---|
| Run | 2 |
| Line equation | y = 2x |
| Angle | 63.43° |
| Distance | 4.4721 |
| Midpoint | (2, 4) |
| Direction | Rising |
Show the work
Formula: slope = rise / run = (y2 − y1) / (x2 − x1)
- Points: (1, 2) and (3, 6)
- Rise: 6 − 2 = 4
- Run: 3 − 1 = 2
- Divide rise by run: 4 / 2 = 2
Result: Slope = 2
How slope is calculated
slope m = (y₂ − y₁) ÷ (x₂ − x₁) = rise ÷ run
Slope measures how steep a line is: the change in y (the rise) divided by the change in x (the run) between two points. A positive slope rises from left to right, a negative slope falls, a horizontal line has slope 0, and a vertical line has no slope because its run is 0.
Once you have the slope m, the line is y = mx + b, where b = y₁ − m × x₁ is the y-intercept. The distance between the points is √(run² + rise²), and the midpoint is the average of the x values and of the y values.
See how we calculate for the formulas, sources and review schedule behind every calculator.
Also useful alongside this calculator: Ratio Calculator, Geometry Calculator and Distance Calculator.
Reading the slope: sign, size and direction
The sign tells you the direction and the size tells you the steepness. A slope of 2 means the line climbs 2 units for every 1 unit to the right. A slope of 0.5 climbs only half a unit per unit, so it is flatter. A slope of −0.75 falls 3 units for every 4 units to the right.
The slope is a single number for the whole line, so any two points on the line give the same answer. That is why the order of the points does not matter, and why the slope is the same near the start of the line as near the end.
Slope as an angle and as a percent grade
The angle between the line and the x axis is arctan(m). A slope of 1 is 45°, a slope of 2 is about 63.43° and a slope of 0.5 is about 26.57°. A negative slope gives a negative angle, such as −36.87° for a slope of −0.75.
Roads and ramps use percent grade, which is slope × 100. A ramp that rises 1 unit over a run of 12 has a slope of 1/12 ≈ 0.0833, an 8.33% grade, and an angle of about 4.76°. Use the rise and run in the same units, such as centimeters on both axes, or the grade will be wrong.
Parallel and perpendicular lines
Two lines are parallel when their slopes are equal. They are perpendicular when the slopes multiply to −1, which means one slope is the negative reciprocal of the other. A line with slope 2 is perpendicular to any line with slope −1/2, and a horizontal line (slope 0) is perpendicular to a vertical one.
How to use the Slope Calculator
- Enter the x and y values of the first point.
- Enter the x and y values of the second point.
- Read the slope, the line equation, the angle, the distance and the midpoint.
- Use Copy, Print or Share to keep the result.
Worked example
For the points (1, 2) and (3, 6), the rise is 6 − 2 = 4 and the run is 3 − 1 = 2, so the slope is 4 ÷ 2 = 2. The y-intercept is 2 − 2 × 1 = 0, so the line is y = 2x. The distance between the points is √20 ≈ 4.4721 and the midpoint is (2, 4). A second example with a negative slope uses (−3, 4) and (5, −2): the rise is −2 − 4 = −6 and the run is 5 − (−3) = 8, so the slope is −6 ÷ 8 = −0.75. The y-intercept is 4 − (−0.75) × (−3) = 1.75, giving y = −0.75x + 1.75. The distance is √(64 + 36) = 10 and the midpoint is (1, 1).
| Points | Slope | Line |
|---|---|---|
| (0, 0) and (4, 2) | 1/2 = 0.5 | Rising |
| (1, 1) and (4, 10) | 3 | Rising |
| (0, 5) and (5, 0) | −1 | Falling |
| (1, 4) and (7, 4) | 0 | Horizontal |
| (3, 1) and (3, 9) | Undefined | Vertical |
Frequently asked questions
What is the slope formula?
Slope = (y₂ − y₁) ÷ (x₂ − x₁): the change in y divided by the change in x between two points.
Why is the slope of a vertical line undefined?
Both points have the same x value, so the run is 0 and dividing by zero is not possible. The calculator shows the line as x = a constant.
Does the order of the points matter?
No. Swapping the two points changes the sign of both rise and run, so the slope is the same.
How do I find the slope from an equation?
Write the equation as y = mx + b. The number multiplying x is the slope. For y = 3x − 5 the slope is 3, and for 2x + 4y = 8 you first solve for y to get y = −0.5x + 2, so the slope is −0.5.
Are my numbers stored or sent anywhere?
No. The calculation runs in your browser and nothing you enter is saved or uploaded.