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.

Choose two points, equation coefficients, or a measured rise and horizontal run. For y = mx + b, use A=m, B=-1 and C=-b. Example: y=2x-3 becomes 2x-y=3, so A=2, B=-1, C=3. Open Try a worked example to load the coefficients for you.

Try a worked example

Loads example values in place of your current inputs. Choose one, then calculate. Examples are hypothetical; your inputs stay in this browser.

  • From (1,2) to (3,6), rise is 4 and run is 2. Slope is 2 and the line is y = 2x.
  • From (-2,5) to (2,-1), rise is -6 and run is 4. Slope is -1.5 and the y-intercept is 2.
  • Points (2,-3) and (2,5) have run 0 and rise 8. The line is x = 2; its slope is undefined, not zero.
  • Move y to the left: 2x - y = 3. Enter A=2, B=-1, C=3. Slope is 2, the y-intercept is -3 and the x-intercept is 1.5.
  • Write 0x + 1y = 4. Enter A=0, B=1, C=4. This horizontal line has slope 0, y-intercept 4 and no x-intercept.
  • Write 1x + 0y = 3. Enter A=1, B=0, C=3. This vertical line has undefined slope, x-intercept 3 and no y-intercept.
Worked diagram: rise 4, run 2
From P1 (1, 2) to P2 (3, 6), run is 2 and rise is 4, so slope is 2. Dashed horizontal and dotted vertical segments show equal x and y scales.
Fixed example: (6 - 2) / (3 - 1) = 4 / 2 = 2. The plotted points use equal coordinate scales. Calculate below to draw and download a diagram for your own points; this teaching image does not use your entries. Open full-size diagram
Use a negative value for a fall.
Use the same length unit as the rise.

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

  1. 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.
  2. Choose two points, enter the four coordinates and calculate. The diagram labels P1 and P2, then separates horizontal run from vertical rise.
  3. Read the signed changes in the calculation table. Reversing both points reverses both changes, so the same line keeps the same slope.
  4. 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.
  5. 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.
  6. 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