How to use the slope calculator
Enter the x and y coordinates of each point. Results update as you change an input; negative and decimal coordinates are supported. To compare two lines, save the first pair as scenario A, then enter the second pair. The comparison shows the difference between their numeric slopes.
Slope formula: rise over run
m = (y₂ − y₁) / (x₂ − x₁). The rise is the change in y; the run is the change in x. Subtract coordinates in the same order in both parts of the fraction. A slope of 2 means y increases by 2 for each increase of 1 in x.
Worked examples
- Positive: (2, 3) to (6, 11): m = (11 − 3) / (6 − 2) = 8 / 4 = 2.
- Negative: (0, 4) to (2, 0): m = (0 − 4) / (2 − 0) = −4 / 2 = −2.
- Zero: (1, 5) to (4, 5): m = (5 − 5) / (4 − 1) = 0 / 3 = 0.
- Undefined: (3, 1) to (3, 9): m = (9 − 1) / (3 − 3) = 8 / 0. Division by zero is undefined.
What your slope means
From left to right, a positive slope rises and a negative slope falls. A horizontal line has equal y coordinates and zero slope. A vertical line has equal x coordinates and undefined slope, not zero. Two identical points do not determine a unique line; their slope is also undefined.
From slope to a right triangle
When both are nonzero, the absolute run and rise form the perpendicular sides of a right triangle. For points (2, 3) and (6, 11), the run is 4 and the rise is 8. To find the straight-line distance between the points, enter their absolute values in the right triangle calculator, using the same unit for both axes. This distance is different from the slope, which is 8 ÷ 4 = 2.
To calculate distance directly from coordinates, use the distance between two points calculator. Distance uses both differences in the formula √(run² + rise²), while slope divides rise by run. A vertical line can have a measurable distance between its points even though its slope is undefined.
How to write the equation of a line from two points
After finding the slope, substitute one known point into y − y₁ = m(x − x₁), the point-slope equation. For points (2, 3) and (6, 11), m = 2, so y − 3 = 2(x − 2). Simplify to y = 2x − 1. The interactive result above also displays an equation when a unique nonvertical line can be determined.
For a vertical line, x stays constant. Points (3, 1) and (3, 9) give x = 3, not an equation of the form y = mx + b. When both entered points are identical, infinitely many lines pass through them, so no unique slope or line equation follows.
Parallel and perpendicular lines: what slope tells you
Distinct nonvertical lines with the same slope are parallel. For example, y = 2x + 1 and y = 2x − 4 have slope 2. Nonvertical perpendicular lines have slopes whose product is −1: a line with slope 2 is perpendicular to one with slope −1/2. A horizontal line is perpendicular to a vertical line, even though the vertical slope is undefined.
Comparing two slopes
Save a valid result as scenario A, then change the coordinates. The difference is the current slope minus the saved slope; neither is labelled better. Undefined slopes cannot be saved or compared numerically. Display rounding does not change the underlying formula.
Background reading
OpenStax Algebra and Trigonometry. This is a subject reference, not an endorsement or independent review of Calcaven.