📐 Slope Calculator
By ToolNimba Education Team · Updated 2026-06-19
Enter two points to compute the slope, line equation, distance, and angle.
The slope of a line measures how steep it is: how much the line rises (or falls) for each step you take to the right. Enter two points and this calculator returns the slope, the full line equation in y = mx + b form, the straight-line distance between the points, and the angle the line makes with the horizontal. It handles the special case of a vertical line, where the slope is undefined.
What is the Slope Calculator?
Slope, often written as the letter m, is the ratio of vertical change to horizontal change between any two points on a line. People remember it as "rise over run": the rise is how far the line goes up or down, and the run is how far it goes across. A positive slope rises from left to right, a negative slope falls, a slope of zero is a flat horizontal line, and a vertical line has no defined slope at all because the run is zero and you cannot divide by zero.
Once you know the slope, you can write the equation of the line. The slope-intercept form y = mx + b uses the slope m and the y-intercept b, which is the y value where the line crosses the vertical axis. You find b by rearranging the equation: b = y1 minus m times x1. With m and b in hand you have a complete description of the line and can predict the y value for any x.
Two related quantities fall out of the same two points. The distance between the points is the length of the straight segment joining them, found with the Pythagorean theorem on the horizontal and vertical gaps. The angle of incline is the angle the line makes with the horizontal axis, and it is the arctangent of the slope. A slope of 1 gives a 45 degree incline, a steeper slope gives a larger angle, and a negative slope gives a negative angle (the line tilts downward).
When to use it
- Checking homework or test answers when finding the slope of a line from two points in algebra or geometry.
- Working out the line equation y = mx + b so you can graph a line or predict values along it.
- Estimating the steepness of a ramp, road, or roof as an angle in degrees from two measured points.
- Finding the straight-line distance between two coordinates while you are at it, since the same points are needed.
How to use the Slope Calculator
- Enter the coordinates of the first point as x1 and y1.
- Enter the coordinates of the second point as x2 and y2.
- Read off the slope, the line equation, the distance, and the angle of incline.
- If x2 equals x1 the line is vertical, so the slope shows as undefined and the equation as x = a constant.
Formula & method
Worked examples
Find the slope, line equation, distance, and angle for the points (1, 2) and (4, 8).
- rise = y2 - y1 = 8 - 2 = 6
- run = x2 - x1 = 4 - 1 = 3
- slope m = 6 / 3 = 2
- b = y1 - m·x1 = 2 - 2 × 1 = 0, so the line is y = 2x
- distance = √(3² + 6²) = √45 ≈ 6.7082
- angle = arctan(2) ≈ 63.4349°
Result: Slope 2, line y = 2x, distance ≈ 6.7082, angle ≈ 63.4349°
Find the slope, line equation, distance, and angle for the points (-2, 3) and (4, -9).
- rise = y2 - y1 = -9 - 3 = -12
- run = x2 - x1 = 4 - (-2) = 6
- slope m = -12 / 6 = -2
- b = y1 - m·x1 = 3 - (-2)(-2) = 3 - 4 = -1, so the line is y = -2x - 1
- distance = √(6² + (-12)²) = √180 ≈ 13.4164
- angle = arctan(-2) ≈ -63.4349°
Result: Slope -2, line y = -2x - 1, distance ≈ 13.4164, angle ≈ -63.4349°
What the sign and size of the slope tells you
| Slope (m) | Direction of the line | Example |
|---|---|---|
| Positive | Rises from left to right | m = 2, angle ≈ 63.4° |
| Zero | Flat, horizontal line | m = 0, angle = 0° |
| Negative | Falls from left to right | m = -1, angle = -45° |
| Undefined | Vertical line (run is zero) | x = 3, angle = 90° |
Common slopes and their angle of incline
| Slope (m) | Angle of incline | As a grade (percent) |
|---|---|---|
| 0.1 | ≈ 5.71° | 10% |
| 0.5 | ≈ 26.57° | 50% |
| 1 | 45° | 100% |
| 2 | ≈ 63.43° | 200% |
| 10 | ≈ 84.29° | 1000% |
Common mistakes to avoid
- Mixing up the order of the points. You must subtract the coordinates in the same order on top and bottom: (y2 - y1) over (x2 - x1), not (y2 - y1) over (x1 - x2). Swapping the order on only one part flips the sign of the slope and gives the wrong direction.
- Inverting rise and run. Slope is rise over run, the vertical change divided by the horizontal change. Writing run over rise computes the reciprocal, which is a different (and usually wrong) number.
- Calling a vertical line zero slope. A horizontal line has a slope of zero. A vertical line has an undefined slope because the run is zero and you cannot divide by zero. The two are easy to confuse but are completely different.
- Forgetting that the angle can be negative. The arctangent of a negative slope is a negative angle, meaning the line tilts downward as you move right. Reporting it as a positive angle loses the direction the line is leaning.
Glossary
- Slope (m)
- The ratio of vertical change to horizontal change between two points on a line, also called the gradient.
- Rise
- The vertical change between two points, y2 minus y1.
- Run
- The horizontal change between two points, x2 minus x1.
- y-intercept (b)
- The y value where the line crosses the vertical axis, found from b = y1 minus m times x1.
- Slope-intercept form
- The equation y = mx + b, which describes a line using its slope m and y-intercept b.
- Angle of incline
- The angle the line makes with the horizontal axis, equal to the arctangent of the slope.
Frequently asked questions
How do you find the slope between two points?
Subtract the y values to get the rise and the x values to get the run, keeping the same order in both, then divide rise by run: m = (y2 - y1) ÷ (x2 - x1). For example, from (1, 2) to (4, 8) the slope is (8 - 2) ÷ (4 - 1) = 6 ÷ 3 = 2.
What is the slope formula?
The slope formula is m = (y2 - y1) ÷ (x2 - x1), where (x1, y1) and (x2, y2) are any two distinct points on the line. It is the vertical change divided by the horizontal change, often remembered as rise over run.
What does a slope of zero mean?
A slope of zero means the line is perfectly horizontal: the y value never changes as x changes. The angle of incline is 0 degrees. This is different from an undefined slope, which describes a vertical line.
Why is the slope of a vertical line undefined?
On a vertical line the two points share the same x value, so the run (x2 - x1) is zero. Slope is rise divided by run, and dividing by zero is undefined, so a vertical line has no slope value. Its equation is written as x = a constant.
How do I get the line equation from the slope?
Once you have the slope m, find the y-intercept with b = y1 - m·x1 using either point, then write the line in slope-intercept form y = mx + b. The calculator does both steps and shows the finished equation.
How is the angle of incline related to the slope?
The angle of incline is the arctangent of the slope: angle = arctan(m). A slope of 1 gives a 45 degree angle, steeper slopes give larger angles up toward 90 degrees, and negative slopes give negative angles because the line tilts downward.