Slope Calculator: Find the Slope of a Line
Finding a line’s slope means measuring how much its vertical position changes compared with its horizontal position. You may need to calculate it from two coordinate points, identify it from an equation, or determine whether two lines are parallel or perpendicular. A small sign or subtraction error can change the result.
The Slope Calculator helps you work through these calculations. It finds the slope as a simplified fraction and decimal, provides line equations in different forms, and calculates related values such as intercepts, angle, distance, midpoint, and percent grade.
The Slope Calculator
Find the slope from two points
Using the Slope Calculator
The Slope Calculator below works in five modes for different types of slope problems. Select a mode, enter the numbers, and the calculator shows the slope and the working.
Find the slope from two points
Select Two Points and enter the coordinates of both points. For example, use (2, 5) and (9, 19).
The calculator finds the vertical change and horizontal change using the same point order: m = (19 - 5) / (9 - 2) = 14 / 7 = 2.
The result includes the slope as a simplified fraction and decimal, along with the line equations and other calculated values.
Find an equation from one point and a slope
Select Point + Slope. Enter a known point and the slope of the line.
For example, enter the point (2, 3) and a slope of 8/3. The calculator finds the equation in all three forms, as well as the two intercepts.
Find the slope from an equation
Select Equation and enter a line in either the y = mx + b form or the Ax + By = C form.
For example: 6x - 2y = 12.
The calculator rearranges the equation to identify the slope and intercepts.
Check parallel and perpendicular lines
Select Parallel/Perpendicular Checker and enter the slopes of two lines.
For example, enter -4 and 4. The calculator checks whether the lines are parallel, perpendicular, or neither. It also shows the perpendicular slope of the first line.
Calculate percent grade
Select Percent Grade and enter a rise and run, or enter a slope.
For example, a rise of 1 and a run of 12 gives: Percent grade = (1 / 12) x 100, about 8.33%.
The calculator returns the percent grade, angle, and rise-to-run ratio.
About the Slope Calculator
This calculator finds the steepness and direction of a straight line using coordinate points, an equation, or a known slope. In coordinate geometry, slope measures the change in y divided by the corresponding change in x.
A line's slope can be:
- Positive: The line rises from left to right.
- Negative: The line falls from left to right.
- Zero: The line is horizontal.
- Undefined: The line is vertical.
The calculator can also provide related information. Depending on the selected mode and available inputs, its results include:
- Simplified fractional slope and decimal slope
- Slope-intercept form
- Point-slope form
- Ax + By = C form
- x-intercept and y-intercept
- Angle of inclination
- Distance between two points
- Midpoint
- Percent grade
- Parallel and perpendicular line checks
When two coordinate points are entered, the calculator displays the subtraction order used for the vertical and horizontal changes. This makes it easier to check the calculation instead of relying only on the final answer.
How to Calculate Slope
This section shows how to find slope using coordinates and equations. You can work these by hand; the Slope Calculator shows the same steps. Slope is rise over run: the vertical change divided by the horizontal change.
Slope formula
For two points (x1, y1) and (x2, y2), use: m = (y2 - y1) / (x2 - x1).
Here, m represents the slope. (y2 - y1) is the vertical change, also called the rise. (x2 - x1) is the horizontal change, also called the run.
The formula is also written as: Slope = Rise / Run.
Worked example using two points
Find the slope of the line passing through (2, 5) and (9, 19).
Step 1: Identify the coordinates. x1 = 2, y1 = 5. x2 = 9, y2 = 19.
Step 2: Substitute the values into the formula. m = (19 - 5) / (9 - 2).
Step 3: Calculate the rise and run. m = 14 / 7.
Step 4: Simplify. m = 2.
The slope is 2. This means the line rises 2 units for every 1 unit it moves to the right.
Worked example: a negative slope
Find the slope of the line passing through (0, 6) and (3, 0).
m = (0 - 6) / (3 - 0) = -6 / 3 = -2.
The slope is -2. This means the line falls 2 units for every 1 unit it moves to the right. Note the subtraction order: (6 - 0) divided by (0 - 3) gives the same answer, 6 / -3 = -2. Reversing both orders keeps the answer; reversing only one changes the sign.
Worked examples: two points
| Points | Rise | Run | Slope | y-intercept | Equation |
|---|---|---|---|---|---|
| (1, 5), (7, 6) | 1 | 6 | 1/6 (about 0.1667) | 4.8333 | y = 0.1667x + 4.8333 |
| (3, 8), (-2, 10) | 2 | -5 | -2/5 (about -0.4) | 9.2 | y = (-2/5)x + 9.2 |
| (2, 3), (5, 11) | 8 | 3 | 8/3 (about 2.667) | -7/3 | y = (8/3)x - 7/3; 8x - 3y = 7 |
| (2, 5), (9, 19) | 14 | 7 | 2 | 1 | y = 2x + 1; 2x - y = -1 |
| (3, 4), (6, 8) | 4 | 3 | 4/3 (about 1.333) | 0 | y = (4/3)x; distance 5; angle 53.13 degrees |
| (3, 2), (7, 9) | 7 | 4 | 7/4 = 1.75 | -3.25 | y = (7/4)x - 3.25; distance about 8.062; angle about 60.26 degrees |
| (7, -4), (4, 8) | 12 | -3 | -4 | 24 | y = -4x + 24; angle about -75.96 degrees |
| (2, 3), (8, 11) | 8 | 6 | 4/3 (about 1.333) | 1/3 | y = 1.3333x + 0.3333; distance 10; midpoint (5, 7) |
| (0, 6), (3, 0) | -6 | 3 | -2 | 6 | y = -2x + 6 |
| (9, 4), (-6, 4) | 0 | -15 | 0 | 4 | y = 4 (horizontal) |
| (1, 2), (5, 10) | 8 | 4 | 2 | 0 | y = 2x; angle 63.43 degrees |
Find the slope from an equation
You can also find slope from equation form without plotting any points.
In slope-intercept form: y = mx + b. The coefficient of x is the slope, and b is the y-intercept.
For example: y = -2x + 5. The slope is -2, and the y-intercept is 5.
If the equation is in the Ax + By = C form, rearrange it to make y the subject.
For example: 6x - 2y = 12. Subtract 6x from both sides: -2y = 12 - 6x. Divide by -2: y = 3x - 6. The slope is 3, the y-intercept is -6, and the x-intercept is 2.
Slope from an equation: worked examples
| Equation | Rearranged | Slope | y-intercept | x-intercept |
|---|---|---|---|---|
| 6x - 2y = 12 | y = 3x - 6 | 3 | -6 | 2 |
| y = 76x + 67 | Already in y = mx + b form | 76 | 67 | -67/76 (about -0.88) |
| y = -2x + 5 | Already in y = mx + b form | -2 | 5 | 2.5 |
Zero slope and undefined slope
Two special cases are important when calculating slope.
A horizontal line has no vertical change. Its rise is zero, so its slope is zero.
For example, the points (9, 4) and (-6, 4) give: m = (4 - 4) / (-6 - 9) = 0 / -15 = 0. The line is y = 4.
A vertical line has no horizontal change. Its run is zero, which would require division by zero. Since division by zero is undefined, a vertical line has no defined slope.
For example, the points (3, 2) and (3, 8) have the same x-coordinate. Their line is x = 3, and its slope is undefined.
The Three Forms of a Line Equation
A straight line can be represented in several algebraic forms. Each form describes the same line but presents its information differently. The Slope Calculator gives all three forms for any line you enter.
Slope-intercept form
The slope-intercept form is: y = mx + b. m is the slope. b is the y-intercept.
For example: y = 2x + 1. The slope is 2, and the line crosses the y-axis at (0, 1).
In the slope intercept form, the slope is the number in front of x.
Point-slope form
Use point-slope form when you know one point on a line and its slope. y - y1 = m(x - x1).
For a line with slope 2 passing through (2, 5): y - 5 = 2(x - 2). This equation describes the same line as y = 2x + 1.
In the point slope form, the slope is the number multiplying (x - x1).
Standard form
The third form is: Ax + By = C. The coefficients are integers, with A nonnegative. An equation in this form does not use fractional or decimal coefficients.
For the same line, y = 2x + 1, rearrange the equation: 2x - y = -1. This is the third form.
Converting between line forms
Consider a line passing through (2, 3) with a slope of 8/3.
Start with point-slope form: y - 3 = (8/3)(x - 2).
Convert to slope-intercept form: y - 3 = (8/3)x - 16/3. Add 3 to both sides: y = (8/3)x - 7/3.
Convert to the Ax + By = C form: Multiply by 3: 3y = 8x - 7. Rearrange: 8x - 3y = 7.
The three forms describe the same line.
Finding the intercepts
The y-intercept is where a line crosses the y-axis. Set x = 0 to find it.
The x-intercept is where a line crosses the x-axis. Set y = 0 to find it.
For: y = 2x + 1. Set x = 0: y = 1. The y-intercept is (0, 1). Set y = 0: 0 = 2x + 1. x = -1/2. The x-intercept is (-0.5, 0).
Parallel and Perpendicular Lines
The slopes of two lines can help determine their relationship. The Slope Calculator checks two slopes and tells you whether the lines are parallel, perpendicular, or neither.
Parallel lines
Two distinct nonvertical parallel lines have the same slope: m1 = m2.
For example, these lines are parallel: y = 3x + 2 and y = 3x - 5. Both have a slope of 3, but they have different y-intercepts.
Vertical lines are also parallel to other vertical lines, even though their slopes are undefined.
Perpendicular lines
Two nonvertical lines with defined slopes are perpendicular when their slopes are negative reciprocals. m1 x m2 = -1.
For example, if the first line has a slope of 2, the perpendicular slope is: m2 = -1/2. The negative reciprocal changes the sign and reverses the fraction.
A horizontal line and a vertical line are also perpendicular. Their slopes are 0 and undefined, respectively, so the product rule is not used for this special case.
Parallel and perpendicular slope examples
| Given slope | Parallel slope | Perpendicular slope |
|---|---|---|
| 3 | 3 | -1/3 |
| 2 | 2 | -1/2 |
| -4 | -4 | 1/4 |
| -1/3 | -1/3 | 3 |
| 0 | 0 | Undefined |
A common mistake is to assume that slopes of -4 and 4 are perpendicular because one is negative and the other is positive. They are neither parallel nor perpendicular. The negative reciprocal of -4 is 1/4, not 4.
Percent Grade and Angle
Slope can also describe how steep a road, ramp, roof, or other surface is. In these situations, it is often expressed as a percent grade or an angle. This section covers slope as percent grade and the angle that goes with it. The Slope Calculator gives the percent grade and the angle in the same result.
Calculate percent grade
Percent grade compares vertical rise with horizontal run: Percent grade = (Rise / Run) x 100.
For example, if a surface rises 1 unit over a horizontal distance of 12 units: Percent grade = (1 / 12) x 100, about 8.33%. A 1:12 rise-to-run ratio therefore represents an 8.33% grade.
For calculations involving percentages beyond slope, the Percentage Calculator can help with other percentage problems.
Calculate the angle
The slope angle comes from the inverse tangent of the slope. theta = arctan(m).
For a slope of 1/12: theta = arctan(1/12), about 4.76 degrees. This gives the signed angle returned by the inverse tangent. For a negative slope, the result is negative. The conventional counterclockwise angle of inclination from the positive x-axis may be expressed between 0 degrees and 180 degrees.
Percent grade and angle examples
| Rise | Slope | Percent grade | Angle |
|---|---|---|---|
| 1:20 | 0.05 | 5% | 2.86 degrees |
| 1:12 | 0.0833 | 8.33% | 4.76 degrees |
| 1:10 | 0.1 | 10% | 5.71 degrees |
| 1:4 | 0.25 | 25% | 14.04 degrees |
| 1:2 | 0.5 | 50% | 26.57 degrees |
| 3:4 | 0.75 | 75% | 36.87 degrees |
| 1:1 | 1 | 100% | 45 degrees |
| 7:4 | 1.75 | 175% | 60.26 degrees |
| 2:1 | 2 | 200% | 63.43 degrees |
| 4:1 | 4 | 400% | 75.96 degrees |
Slope in practical calculations
Slope can describe a rate of change when the two axes represent different measurements. The Slope Calculator treats slope as a rate whenever the axes measure different things.
For example, if rainfall increases from 1 inch at 2 hours to 2 inches at 5 hours, the rate is: (2 - 1) / (5 - 2) = 1 / 3. The rainfall changes by an average of 1/3 inch per hour over that interval. For other distance-over-time calculations, an Average Calculator may help with average values.
A slope can also describe a physical grade. If a road rises 180 feet over a horizontal run of 2,000 feet: (180 / 2000) x 100 = 9%. The grade is 9%. If the same rise is spread over a 3,000-foot run, the grade is (180 / 3000) x 100 = 6%.
A roof rising 60 inches over a 180-inch run has a slope of 60 / 180 = 1/3, a 4:12 pitch, and an angle of 18.43 degrees.
A business whose revenue rises from 200 to 350 between month 2 and month 8 grows at (350 - 200) / (8 - 2) = 25, or $25k per month.
For an accessible ramp, the 2010 ADA Standards specify a general maximum running slope of 1:12 for ramps on accessible routes, subject to stated exceptions. A rise of 24 inches at that ratio requires a horizontal run of: 24 x 12 = 288 inches = 24 feet. The applicable requirements depend on the type of ramp and the relevant standards. A mathematical slope calculation alone does not establish compliance.
Common Slope Calculation Mistakes
Small errors in coordinate order, signs, or interpretation can lead to an incorrect result. Check these points when solving a slope problem. The Slope Calculator shows the subtraction order so you can catch the first mistake below.
1. Mixing the subtraction order
If you subtract the y-coordinates in one order, you must subtract the x-coordinates in the same order.
For points (7, 9) and (3, 2), the correct calculation is: m = (9 - 2) / (7 - 3) = 7 / 4 = 1.75. Using (9 - 2) in the numerator and (3 - 7) in the denominator would produce -1.75, which is incorrect.
You can reverse both subtraction orders, but you cannot reverse only one.
2. Averaging slopes instead of using the required points
The slope between two specified points comes from their vertical and horizontal changes. Do not simply average separate slope values unless the problem specifically asks for an average.
For example, the points (2, 3) and (4, -5) give: m = (-5 - 3) / (4 - 2) = -8 / 2 = -4. The slope is -4.
3. Confusing a horizontal line with a vertical line
A horizontal line has a slope of zero because its rise is zero. A vertical line has no defined slope because its run is zero.
These terms are not interchangeable.
4. Reversing rise and run
Slope is vertical change divided by horizontal change. Reversing the fraction gives a different value.
For a rise of 8 and a run of 4: m = 8 / 4 = 2. The value 4/8 is not the slope of that line.
5. Treating any negative slope as perpendicular
Perpendicular slopes must be negative reciprocals, not merely numbers with opposite signs.
For example, the negative reciprocal of 4 is -1/4. A slope of -4 is not perpendicular to a slope of 4.
Why Your Calculated Slope May Differ
If your result does not match another calculation, check how the values were entered and displayed. If the Slope Calculator gives a different answer from another source, the method or the inputs usually differ.
Decimal rounding: A fraction such as 1/6 is repeating as a decimal. A displayed value of 0.1667 is rounded, not an exact replacement for the fraction.
Point order: Reversing both points should give the same slope. Reversing only the numerator or denominator subtraction order changes the sign.
Equation form: If an equation is not in slope-intercept form, rearrange it before reading the coefficient of x as the slope.
Percent grade and angle: These are different measurements. Percent grade is the slope multiplied by 100, while the angle is found using the inverse tangent.
Vertical lines: A vertical line has no defined slope. It should not be displayed as zero or treated as an ordinary decimal.
Keeping the exact fractional result alongside its decimal equivalent can help you identify rounding differences.
Frequently Asked Questions
Final Thought
Slope connects coordinate geometry with rates of change and physical grades. Use the Slope Calculator to check your hand working: use the same subtraction order for both coordinates, keep fractions when they provide a more exact result, and distinguish a horizontal line from a vertical line. These checks make it easier to calculate and interpret the slope correctly.
