What Is a Slope Calculator?
A slope calculator finds how steep a straight line is from two points on it. Enter point A (x1, y1) and point B (x2, y2), and this slope calculator returns the slope as a decimal and a simplified fraction, the angle in degrees, the percent grade, and the full line equation in the form y = mx + b.
Slope is one of the most useful numbers in algebra: it tells you how fast y changes when x changes. Engineers use it for ramps and roofs, and students meet it in nearly every math class. A positive slope climbs left to right, a negative slope falls, a zero slope is flat, and a vertical line has undefined slope.
How to Use This Slope Calculator
- Enter the first point. Type the x and y values of point A into the x1 and y1 boxes. Decimals and negatives work fine.
- Enter the second point. Type the x and y values of point B into the x2 and y2 boxes. The two points must not be identical.
- Press Calculate Slope. Empty or non-numeric boxes trigger a friendly error message telling you which box to fix.
- Read the results. You get the slope as a decimal and a reduced fraction, the angle in degrees, the percent grade, and the line equation.
- Try the special cases. Use the same x value for both points to see a vertical line with undefined slope, or the same y value for both points to see a horizontal line with slope zero.
All math runs in your browser, with answers rounded to four decimals.
The Slope Formula, Explained
The formula behind every slope calculator is short: m = (y2 - y1) / (x2 - x1). The top of the fraction is the rise, the vertical change between the points, and the bottom is the run, the horizontal change. Take the points (1, 2) and (4, 8): the rise is 8 - 2 = 6, the run is 4 - 1 = 3, and the slope is 6 / 3 = 2, which means y grows twice as fast as x along this line.
Slope is rise over run - a ratio - so a ratio calculator is the natural partner tool when you want steepness in its simplest form. With the slope in hand, build the full line equation from the point-slope form y - y1 = m(x - x1), then solve for y to get y = mx + b. The intercept b is where the line crosses the y-axis.
Two points also define a distance: the straight-line gap between them is the hypotenuse of a right triangle with legs |x2 - x1| and |y2 - y1|, which a Pythagorean theorem calculator can compute for you. Slope and distance together describe the segment completely.
Slope Calculator Worked Examples
Every number below was computed and double-checked with the calculator above. Try one by hand, then confirm it.
| Point A | Point B | Slope (decimal) | Slope (fraction) | Line equation |
|---|---|---|---|---|
| (1, 2) | (4, 8) | 2 | 2/1 | y = 2x |
| (2, 3) | (5, 9) | 2 | 2/1 | y = 2x - 1 |
| (1, -2) | (3, -6) | -2 | -2/1 | y = -2x |
| (10, 5) | (20, 8) | 0.3 | 3/10 | y = 0.3x + 2 |
Check the first row: rise = 8 - 2 = 6, run = 4 - 1 = 3, slope = 6 / 3 = 2. Using point A, 2 = 2(1) + b, so b = 0 and the equation is y = 2x. The angle is about 63.43 degrees and the grade is 200 percent. In the last row, 5 = 0.3(10) + b gives b = 2, so the equation is y = 0.3x + 2 with an angle of about 16.70 degrees.
Vertical and horizontal lines are the two special cases. Points (3, 1) and (3, 5) give run = 0, so the division is impossible and the slope is undefined; the line is simply x = 3. Points (1, 5) and (7, 5) give rise = 0, so the slope is 0 and the equation is y = 5.

Frequently Asked Questions About Slope
What is the formula for slope?
The slope formula is m = (y2 - y1) / (x2 - x1): subtract the y values for the rise, subtract the x values for the run, then divide. A slope calculator automates exactly this and reduces the result to a fraction for you.
What does a negative slope mean?
A negative slope means the line falls as you move left to right: y decreases while x increases. For (1, -2) and (3, -6), the slope is -2, so y drops by 2 for every 1 unit x moves right. Downhill roads and falling prices are everyday negative slopes.
Can the slope be a fraction?
Yes, often. Points (10, 5) and (20, 8) give a slope of 3/10, or 0.3 as a decimal: the line rises by the numerator for every denominator units of run. To convert a fractional slope by hand, a fraction to decimal calculator performs the division instantly.
What is the slope of a vertical line?
A vertical line has an undefined slope, not a zero slope. Both points share the same x value, so the run is 0 and division by zero is impossible. The calculator flags this case and reports the equation as x = a, for example x = 3.
What is the difference between slope and percent grade?
Percent grade is the slope times 100: a slope of 2 is a 200 percent grade, and a slope of 0.3 is 30 percent. Road signs use percent grade - a 10 percent grade means the road rises 10 feet per 100 feet of horizontal distance, a slope of 0.1.
How do you find the equation of a line from two points?
Find the slope m = (y2 - y1) / (x2 - x1), then plug one point and the slope into y = mx + b and solve for b. For (2, 3) and (5, 9), the slope is 2, and 3 = 2(2) + b gives b = -1, so the equation is y = 2x - 1. The calculator does all of this in one step.
Learn More
Keep building your math toolkit with these related calculators: