Slope Calculator

Slope and the equation of a line through two points

Slope (m)
2.0000

Line equation: y = 2.0000x + 0.0000

Frequently Asked Questions

What does an undefined slope mean?
When both points share the same x-coordinate, the line is perfectly vertical, and slope (rise/run) is undefined because "run" is zero — you can't divide by zero.
Is my data sent anywhere?
No. Everything is calculated locally in your browser.

Calculating the slope and full equation of a line through two given points relies on a single ratio — rise over run, the change in the vertical coordinate divided by the change in the horizontal coordinate — but correctly identifying which coordinate changes go in the numerator versus denominator, and handling the special cases of vertical and horizontal lines, are where most slope-calculation errors actually happen.

Why "rise over run" needs careful sign-tracking, and two special cases

Slope is calculated as the change in the y-coordinate divided by the change in the x-coordinate between two points — critically, both changes need to be calculated in the same direction (point 2 minus point 1 for both coordinates, not mixed directions), since swapping the order for just one coordinate flips the sign of the resulting slope. Two special cases don't fit the standard formula cleanly: a vertical line (where both points share the same x-coordinate) has an undefined slope, since the standard formula's denominator would be zero — vertical lines simply aren't expressible in standard slope-intercept form at all. A horizontal line (where both points share the same y-coordinate) has a slope of exactly zero, which is a well-defined value, unlike the undefined vertical case, even though both situations involve two points sharing one coordinate.

A worked example

Two points that share the same x-coordinate but different y-coordinates describe a vertical line with undefined slope, while two points sharing the same y-coordinate but different x-coordinates describe a horizontal line with a slope of exactly zero — these look like superficially similar "shared coordinate" situations, but one produces an undefined result and the other produces a perfectly well-defined one, which is a distinction worth checking for explicitly before assuming the standard slope formula will always produce a sensible number.

How this connects to your other math calculations

Slope calculations connect directly to the broader geometric relationships covered by the Distance Calculator — both work with coordinate pairs, and a full geometric description of a line segment between two points typically involves both its length (distance) and its direction (slope).

Common mistakes

Calculating the change in y using one point-order direction while calculating the change in x using the reversed order (rather than consistently using "point 2 minus point 1" for both) is a common sign error that flips the calculated slope's sign incorrectly — always subtract the coordinates of the two points in a consistent, matching order for both the x and y changes.

Related Calculators

Distance Between Two PointsWater Intake CalculatorCurrency ConverterDay of the Week CalculatorDharana & Khandi/Candy CalculatorSleep Calculator