Slope Calculator
A rise of 3 over a horizontal run of 12 gives a slope of 0.25, or a 25% grade. Choose Rise and run to enter your measurements, or use two points or a line equation.
Your result
About this tool
Enter two points to calculate slope and intercepts, or supply a line in Ax + By = C form. Inspect your two points on an equal-scale rise/run diagram. Vertical and horizontal lines are handled explicitly; equation mode shows schematic direction.
Follow the signed rise and run
- For a measured rise and run, choose Rise and run and enter both lengths in the same unit. A rise of 3 over a horizontal run of 12 gives slope 3 ÷ 12 = 0.25, grade 25% and an incline of about 14.036°. Enter a negative rise for a fall. The graph shows these offsets from an assumed origin (0, 0) and can be saved as an SVG.
- Choose two points, enter the four coordinates and calculate. The diagram labels P1 and P2, then separates horizontal run from vertical rise.
- Read the signed changes in the calculation table. Reversing both points reverses both changes, so the same line keeps the same slope.
- Try the positive, negative and vertical examples above the inputs. A vertical line has zero run and undefined slope; a horizontal line has zero rise and slope zero. Identical points cannot define one unique line.
- For Ax + By = C, choose equation mode and enter all three coefficients. If your equation is y = mx + b, move terms to get mx - y = -b, then enter A=m, B=-1 and C=-b. The equation examples load these coefficients directly. The graph in this mode shows direction only; use the displayed equation and intercepts for coordinate values.
- In two-points mode, use Download slope diagram (SVG) below the graph to save an editable vector image for notes or worksheets. It includes your coordinates, signed rise/run and equal-scale notes. Labels are rounded; the SVG description retains the numeric coordinates. Check the file before sharing. Generation stays in your browser; equation mode does not offer this points diagram.
How the calculation works
For two points, m = (y₂ − y₁) / (x₂ − x₁). The y-intercept is y₁ − mx₁. For Ax + By = C and B ≠ 0, m = −A/B and the y-intercept is C/B. Distance = √(Δx² + Δy²).
Worked example
Points (1,2) and (3,6) have Δx=2 and Δy=4, so slope=2 and the line is y=2x. Distance is √20, approximately 4.472. Points with the same x define a vertical line. The line x = 0 lies on the y-axis, so every point on it is a y-intercept. A vertical line such as x = 2 never crosses the y-axis.
Enter a line written as y = mx + b
Equation mode accepts the three numeric coefficients in Ax + By = C; it does not parse typed equations. In y = mx + b, the lowercase b is the y-intercept. Move terms to get mx - y = -b: the form needs A=m, B=-1 and C=-b. The uppercase B coefficient is therefore -1, not the intercept.
For y = 2x - 3, rearrange to 2x - y = 3. Enter A=2, B=-1, C=3, or load the worked equation example. The results are slope 2, y-intercept -3 and x-intercept 1.5. Substituting x=1.5 into the original equation gives y=0, which independently checks the x-intercept.
For a horizontal line y = 4, enter A=0, B=1, C=4. Its slope is zero and it never crosses the x-axis. For a vertical line x = 3, enter A=1, B=0, C=3. Its slope is undefined and it never crosses the y-axis. The line y=0 is the special horizontal case in which every x lies on the x-axis.
Why a negative run can still give a positive slope
Slope compares signed changes, not unsigned distances. Moving from (3,6) back to (1,2) gives rise -4 and run -2. Their quotient is still 2. The line rises as x increases, regardless of the order in which its points were entered.
Do not read steepness from a chart with unequal axis scales. This points diagram uses equal x/y scales and follows your coordinates; axis-zero lines appear only when they fall inside the view. Very close coordinates can share rounded labels, so retain the original input precision when checking a result.
Assumptions and limitations
Each coordinate or coefficient is between −10¹² and 10¹². Coincident points do not define a unique line. A and B cannot both be zero. Display uses up to 12 significant digits and floating-point arithmetic. Extremely small intermediate values and overflowing results produce a range error instead of an inaccurate zero or infinity. Point coordinates in the subnormal range are outside this model.
Slope is signed rise divided by run. A vertical line has undefined slope, not zero slope. Points mode frames the entered coordinates at equal x/y scales. Equation mode shows direction around an intercept only. Neither view is a survey, building design or substitute for measured coordinates.
Sources and editorial responsibility
Maintained by Renvoro Pty Ltd. Sources inform the methods and assumptions shown here; outputs have the limitations described on this page.
Common questions
What is the slope through (2, 3) and (6, 11)?
The rise is 11 − 3 = 8 and the run is 6 − 2 = 4. Divide the rise by the run to get a slope of 2.
What happens if both points have the same x-coordinate?
Distinct points at the same x-coordinate form a vertical line. Its run is zero and its slope is undefined. Repeated identical points do not determine a unique line.
How do I get the y-intercept from two points?
Once you know the finite slope m, substitute either point into b = y − mx. For (2, 3) with slope 2, the intercept is −1.
Guide updated 2026-10-26. Calculation method and source dates remain separate.
Method reviewed 2026-10-13. Calculation standards · Report an issue