Slope Calculator
This slope calculator finds the straight line through two distinct coordinate points. It reports rise, run, slope, and y-intercept for nonvertical lines, and identifies vertical lines without treating their undefined slope as a finite number.
By Dr. Hassan Khames EliwaLast updated
Result
- Rise
- 8
- Run
- 4
- Y-intercept
- -1
How it works
Calculate changes in a consistent order
For points (x1, y1) and (x2, y2), rise = y2 - y1 and run = x2 - x1. When the run is nonzero, slope m = rise / run. Use the same point order in both differences. Reversing both differences leaves the slope unchanged; reversing only one changes its sign incorrectly.
A positive slope means y increases as x increases. A negative slope means y decreases as x increases. A zero slope describes a horizontal line, where both points have the same y-coordinate but different x-coordinates. Slope measures change per unit of x, so its units are y-units divided by x-units unless the coordinate units cancel.
Recover the intercept
For a nonvertical line, y = mx + b. Once the slope is known, the calculator obtains the y-intercept from b = y1 - m × x1. The intercept is the line's y-value at x = 0. That location may lie far outside the observed points, so an algebraically valid intercept is not always a meaningful real-world prediction.
Handle special geometry explicitly
If the x-coordinates match but the y-coordinates differ, the line is vertical. Its slope is undefined because the run is zero, and its equation is x = x1. The result shows that equation instead of a y-intercept. A vertical line cannot generally be expressed as a single-valued function y = mx + b.
If both coordinates match, the two entries describe only one point. Infinitely many lines pass through that point, so the calculator returns an error rather than choosing one. Four finite coordinates are required, each with magnitude no greater than 1e12. Computed nonfinite slopes or intercepts are also rejected.
Read the display carefully
Most numeric results show up to ten decimal places. Scientific notation is used for very small nonzero values and magnitudes at least 1e15. Coordinates that differ by less than floating-point resolution may become indistinguishable; rescale or recenter unusually delicate problems before interpreting the geometry.
Worked example
Example 1: a rising calibration line
A hypothetical calibration chart contains points (2, 3) and (6, 11). Enter x1 = 2, y1 = 3, x2 = 6, and y2 = 11. Rise is 8 and Run is 4, so Slope is 2. Y-intercept is -1. The resulting relationship is y = 2x - 1, which reproduces both supplied points when their x-values are substituted.
Example 2: a descending line
A second exercise uses points (-2, 5) and (4, -7). Enter those coordinates in that order. Rise is -12 and Run is 6. Slope is -2, and Y-intercept is 1. The line is y = -2x + 1. The negative rise with a positive run makes the negative slope visible before any division is performed.
Expert tips
Common mistakes
- Taking absolute differences. Removing the signs from rise and run destroys directional information. Use signed subtraction so descending and ascending lines remain distinguishable.
- Calling a vertical slope zero. A horizontal line has zero rise and nonzero run. A vertical line has zero run, making its slope undefined; these are different geometric cases.
- Reading graph steepness without checking scales. Changing the visual aspect ratio can make the same slope look steeper or flatter. Numerical rise over run depends on axis values, not the angle a stretched chart appears to show.
Frequently asked questions
Can I enter negative coordinates?
Yes. Negative coordinates are valid within the stated magnitude limit. Signed differences are preserved throughout the calculation, so crossing an axis does not require special treatment.
What happens if I reverse the points?
Rise and run both change sign, but their ratio and the y-intercept remain the same. The line itself does not depend on which point is entered first.
Is slope the same as percentage grade?
Only after accounting for units and multiplying an appropriate dimensionless rise-over-run ratio by one hundred. This page reports the raw slope rather than assuming the coordinates describe a physical grade.
Why are identical points rejected?
One point does not determine a unique line. The resulting zero-over-zero ratio is indeterminate, so there is no single slope or intercept to report.
Can a y-intercept be outside the measured range?
Yes. It is defined at x equal to zero whether or not that x-value lies between the two points. Treat any real-world interpretation outside the observed interval as extrapolation.
Related calculators
Related guides
MathPercentages people get wrong: change, difference and pointsThe denominator determines the answer. Learn to distinguish percentage change, symmetric difference and percentage-point movements.14 November 2026 · 7 min read
MathStandard deviation without the jargonThe average tells you the centre. Standard deviation helps describe the spread, provided you know what the data represents.14 November 2026 · 7 min readAbout the author
Dr. Hassan Khames Eliwa holds a PhD in Construction & Built Environment and has more than 20 years of international project controls experience. He is Director of Eliwa Project Controls Limited in Auckland and founder of PMMilestone.org and PMMilestone.com.
Buy me a coffee