How this calculator works
- Step 1Risey₂ − y₁How far the line goes up (or down).
- Step 2Runx₂ − x₁How far it goes across.
- Step 3Sloperise ÷ runSteepness: up per unit across.
The slope of a line measures how steep it is: how far it rises for each step to the right. A negative slope falls from left to right.
From the slope and one point, the calculator also writes the line as y = mx + b and gives its angle, the distance between the points and their midpoint.
Worked example: (−2, −3) and (−7, 4)
- Slope
m = (y₂ − y₁) ÷ (x₂ − x₁)
- Rise4 − (−3)7
- Run−7 − (−2)−5
- Slope7 ÷ −5−7/5
This is OpenStax’s Example 4.34. The line is y = −1.4x − 5.8. Example 4.33, through (1, 2) and (4, 5), has slope 1.
Horizontal and vertical lines
- Horizontalm = 0Same y for both points: y = 3.
- VerticalUndefinedSame x for both points: x = 2. The run is 0.
Read the result
The headline is the slope, as a fraction when the points are whole numbers; the table adds the equation, angle, distance and midpoint.
The angle is measured from the positive x-axis, between −90° and 90°. A slope of 1 is 45°.
Assumptions and limits
- Two different pointsThe same point twice does not fix a line.
- Cartesian planex across, y up, the same scale on both axes.
- Six decimalsDecimal answers are rounded for display only.
Related coordinate tools
Two points fix a line. Distances, midpoints and directions all follow from the same coordinates.
For distance in two or three dimensions, use the distance calculator. The vector calculator finds angles and products between directions, and the triangle calculator solves the shape the points make.
Common mistakes
Mistake: Dividing run by rise.
Instead: Slope is rise over run: change in y divided by change in x.
Mistake: Mixing the order: y₂ − y₁ over x₁ − x₂.
Instead: Subtract in the same order on top and bottom.
Mistake: Calling a vertical line’s slope zero.
Instead: Zero is horizontal; vertical is undefined.
Checking the method
Every golden case is rechecked with exact fractions, and two OpenStax examples are reproduced.
An independent script finds the intercept from the second point rather than the first, and the angle with a two-argument arctangent.
Read how we test our calculators, or browse more maths calculators.