Menu

Slope Calculator

Drag two points and watch the slope, the line and every form change.

By Nethanel Bar, Co-founder & CEO

Last updated

Want to solve these without the calculator?

The Coddy math course teaches the method itself - you work each step on an interactive board and get told exactly where a move went wrong.

Slope is rise over run, and you can watch it happen

The slope of a line is how much it climbs for each step to the right: the change in y divided by the change in x, between any two points on it. Every rule about slope follows from that one sentence - a positive slope climbs, a negative one falls, a horizontal line has slope zero, and a vertical line has no slope at all because its run is zero and nothing can be divided by zero.

Which is easy to say and hard to feel from a formula. So this page draws it: the run along and the rise up, as a staircase between your two points. Drag one of them and watch which number changes. Doubling the rise doubles the slope; doubling the run halves it; moving a point along the line changes neither, which is the fact that makes slope worth defining in the first place.

You also get everything else two points determine, exactly: the equation of the line in all three forms your homework might ask for, the distance between the points as an exact radical, the midpoint, the intercepts, and the slope of any perpendicular line. Nothing is rounded on the way - the distance between (0,0) and (2,3) is √13, not 3.6056.

What to watch for while you drag

  • Slope does not depend on which two points you pick, as long as they are on the same line. Drag a point along the line and the slope stays put - that is what makes it a property of the line rather than of the points.
  • The sign is the direction. Climbing left to right is positive, falling is negative, and a flat line is exactly zero.
  • A vertical line has no slope. Not zero - undefined, because the run is zero. Zero slope and undefined slope are opposites, and confusing them is the single most common error on this topic.
  • Steepness is the size of the slope, ignoring the sign. A slope of -4 is steeper than a slope of 2.
  • Perpendicular slopes multiply to -1. Drag until the slope is 2 and the perpendicular reads -1/2; that relationship is worth seeing rather than memorising.

How to use the slope calculator

  1. Type the two points, or drag them

    Fill in the four boxes, or drag either dot on the plane. Arrow keys work too, one unit at a time, so the plane is usable without a mouse.

  2. Read the slope, then the forms

    The slope is at the top as an exact fraction with its decimal beside it. Under it are slope-intercept, point-slope and standard form of the same line - whichever your question asks for.

  3. Watch the staircase

    The dashed lines between your points are the run and the rise. If the fraction ever looks wrong, count the squares: the picture and the arithmetic have to agree.

  4. Take the extras if you need them

    Distance, midpoint, both intercepts, the angle with the x-axis and the perpendicular slope are all worked out below - these are the other things a two-point question usually wants.

Slope quick reference

The formulas behind every number on this page, with the case each one is for.

WhatFormulaNote
Slopem = (y₂ - y₁)/(x₂ - x₁)Rise over run, in that order
Slope-intercept formy = mx + bb is where the line crosses the y-axis
Point-slope formy - y₁ = m(x - x₁)Fastest from a point and a slope
Standard formAx + By = CA, B, C whole numbers, A positive
Horizontal linem = 0y = c
Vertical linem undefinedx = c
Parallel linessame mNever meet
Perpendicular linesm₁ × m₂ = -1Negative reciprocal
Distance√((x₂-x₁)² + (y₂-y₁)²)Pythagoras on the staircase
Midpoint((x₁+x₂)/2, (y₁+y₂)/2)The average of each coordinate

Worked examples

A negative slope: (3, 8) and (5, 2)

The rise is 2 - 8 = -6 and the run is 5 - 3 = 2, so the slope is -6/2 = -3. The line falls three units for every step to the right. Watch the order: taking the differences the other way round gives 6 and -2, which is the same slope - what you must not do is take y one way and x the other.

A fractional slope: (1, 2) and (4, 6)

Rise 4, run 3, so the slope is 4/3 and stays a fraction. 1.33 is a rounding of it, and on a question about slope the fraction is the answer. The line's equation comes out as y = 4x/3 + 2/3, which is why standard form (4x - 3y = -2) is often the tidier way to write it.

A vertical line: (2, 5) and (2, -1)

Both points have x = 2, so the run is zero and the slope is undefined - not zero. The line is x = 2, which cannot be written as y = mx + b at all. This is the case a formula alone will not tell you about, and the page says it in words.

A horizontal line: (-3, 4) and (5, 4)

The rise is zero, so the slope is 0/8 = 0. The line is y = 4. Compare it with the vertical case above: zero on top gives a slope of zero, zero underneath gives no slope, and the two are as different as it gets.

Common mistakes

  • Putting the run on top. It is rise over run - the change in y divided by the change in x, and not the other way round.
  • Subtracting in different orders. If you do y₂ - y₁ on top, do x₂ - x₁ underneath. Mixing them flips the sign.
  • Saying a vertical line has slope zero. It has no slope; the horizontal line is the one with slope zero.
  • Losing the sign on a negative coordinate. 4 - (-3) is 7, not 1, and this is where most wrong slopes come from.
  • Rounding the fraction. A slope of 4/3 is exact; 1.33 is not, and a marking scheme can tell.
  • Using the perpendicular slope without the sign. The negative reciprocal of 2 is -1/2, not 1/2.

Slope FAQ

How do I find the slope between two points?
Subtract the y-coordinates to get the rise, subtract the x-coordinates in the same order to get the run, and divide: m = (y₂ - y₁)/(x₂ - x₁). Then reduce the fraction. The steps on this page are that calculation with your numbers substituted in.
What is rise over run?
It is the slope, described as a picture: how far the line goes up (the rise) for a given step to the right (the run). The dashed staircase on the plane above is drawn between your two points, so the fraction and the picture are the same thing.
What is the slope of a vertical line?
Undefined. Both points have the same x, so the run is zero, and nothing can be divided by zero. This is different from a horizontal line, whose slope is exactly zero. A vertical line's equation is x = c and cannot be written as y = mx + b.
How do I get the equation of a line from two points?
Find the slope first, then put one of the points into y = mx + b and solve for b. This page shows both steps, and also prints point-slope form, which skips the second step: y - y₁ = m(x - x₁) is the equation as soon as you have the slope.
What are parallel and perpendicular slopes?
Parallel lines have the same slope. Perpendicular lines have slopes whose product is -1, which means one is the negative reciprocal of the other: 2 and -1/2, or -3/4 and 4/3. The perpendicular slope is printed under the answer.
Does it give the distance and midpoint too?
Yes, both exactly. The distance is Pythagoras applied to the same rise and run, so it is often an irrational number - it is given as a simplified radical like 2√10 with a decimal beside it, rather than only as a rounded number.
Can I type fractions or decimals as coordinates?
Yes. The boxes accept whole numbers, fractions like 1/2 and decimals like 0.75, and everything downstream stays exact - 0.5 is read as one half. Dragging snaps to whole numbers, which is what makes it easy to count squares.

More math tools

Coddy programming languages illustration

Learn math with Coddy

GET STARTED