Slope Calculator (Two Points)
Last updated: 27 August 2026
Reviewed by Gavin Meiring, Lead research and primary author · Doctoral Candidate (Corporate Governance) · Research and drafting assisted by AI
- The word 'slope' entered mathematics from Old English, and surveyors were measuring land gradients long before coordinate geometry was invented.
- A 45° line has a slope of exactly 1, and slope equals tan(θ), so the angle of inclination is just the arctangent of the slope.
- A vertical line has an undefined slope — the run (x₂ − x₁) is zero, and division by zero has no answer, which is why vertical lines break the slope formula.
Slope Calculator (two points
Slope measures how steeply a line rises or falls, and this calculator finds it from two coordinate pairs. Enter the coordinates of two points on the line and the tool returns the slope, the rise, the run and the direction of the line. It is used by students working through coordinate geometry, by anyone reading a gradient off a chart, and by anyone who needs a rate of change from two readings.
The Formula
The Slope Calculator is built around slope = (y2 - y1) / (x2 - x1). The exact rearrangement depends on which variable you are solving for; the calculator handles all common arrangements automatically, so you only need to enter the known values and the tool will return the unknown.
The formula subtracts the y-coordinates of the two points and divides that difference by the difference of their x-coordinates, in matching order:
slope = (y2 - y1) / (x2 - x1)
m = rise / run
Both lines above say the same thing. The rise is the vertical change between the two points, the run is the horizontal change, and the slope is the rise divided by the run. The letter m is the conventional symbol for slope, and in British English the same quantity is often called the gradient.
The order of subtraction has to match in the two parts of the fraction. Taking the first point from the second in the numerator means taking the first point from the second in the denominator as well. Reverse one and not the other and the sign of the answer flips, which is the single most common way to get a slope wrong.
How to Use
- Enter the known values into the input fields.
- Select the variable you want to solve for, if the Slope Calculator offers a reverse mode.
- Confirm the units of each input match the labels on the fields.
- Click Calculate to see the result.
- Read the result in the unit the tool returns; convert manually if you need a different unit.
Worked Examples
Four cases cover the whole range of answers the formula can give: a positive slope, a negative slope, a vertical line and a horizontal line.
Example 1, a positive slope. Find the slope of the line through (2, 3) and (6, 11).
Take the differences in matching order. Rise: 11 - 3 = 8. Run: 6 - 2 = 4. Slope: m = 8 / 4 = 2.
The line rises two units for every one unit it moves to the right. Confirm the result by reversing the order of subtraction: rise 3 - 11 = -8 and run 2 - 6 = -4, and -8 / -4 is still 2. Reversing both keeps the sign, which is the check worth running when an answer looks wrong.
Example 2, a negative slope. Find the slope of the line through (1, 5) and (4, -4).
Rise: -4 - 5 = -9. Run: 4 - 1 = 3. Slope: m = -9 / 3 = -3.
The line falls three units for every one unit it moves to the right. A negative slope means the two quantities move in opposite directions, which is what you expect from a falling graph.
Example 3, a vertical line. Find the slope of the line through (3, 2) and (3, 9).
Rise: 9 - 2 = 7. Run: 3 - 3 = 0. Slope: m = 7 / 0, which is undefined.
Division by zero is not a very large number, it is no number at all, so a vertical line has no slope. The tool reports it as undefined rather than as infinity, and that is the correct answer. Write the line's equation as x = 3 instead.
Example 4, a horizontal line. Find the slope of the line through (0, 4) and (7, 4).
Rise: 4 - 4 = 0. Run: 7 - 0 = 7. Slope: m = 0 / 7 = 0.
A slope of zero and an undefined slope are different results, and the difference is which difference came out as zero. Zero rise over a non-zero run gives a flat line. A zero run gives a vertical line and no slope at all.
Reading the result
The table below collects the four cases with the intermediate values the calculator produces, so you can see how each answer is built rather than only what it comes to.
| Points | Rise (y2 - y1) | Run (x2 - x1) | Slope | Line type |
|---|---|---|---|---|
| (2, 3) and (6, 11) | 8 | 4 | 2 | Rising |
| (1, 5) and (4, -4) | -9 | 3 | -3 | Falling |
| (3, 2) and (3, 9) | 7 | 0 | Undefined | Vertical |
| (0, 4) and (7, 4) | 0 | 7 | 0 | Horizontal |
| (-2, 1) and (2, 9) | 8 | 4 | 2 | Rising |
The last row repeats the slope of the first row from different coordinates, and that is not a coincidence to skip past. The two lines are parallel, because parallel lines have equal slopes. Two pairs of points can share a slope and still describe different lines, which is why the slope alone does not identify a line and you need the equation to pin one down.
From the slope to the equation of the line
The slope is half of what you need for the equation of a line. The other half is one point on it, which the question already gave you.
Take the first example again, with the points (2, 3) and (6, 11) and a slope of 2. Use the point-slope form, y - y1 = m(x - x1), with the point (2, 3):
y - 3 = 2(x - 2) y - 3 = 2x - 4 y = 2x - 1
Check it against the second point. At x = 6, y = 2 x 6 - 1 = 11, which is the y-coordinate you started with. The line is y = 2x - 1, with a slope of 2 and a y-intercept of -1.
The same line comes out of the other point, which is a useful confirmation. Using (6, 11) instead: y - 11 = 2(x - 6), so y = 2x - 12 + 11 = 2x - 1. Either point gives the same equation, because both points sit on the same line.
What a slope means in units
A slope carries units, and reading them is often more useful than the number itself. If x is measured in hours and y in kilometres, a slope of 2 means 2 kilometres per hour, a speed. If x is months and y is currency, a slope of -3 means the balance falls by 3 per month. If x is a temperature in degrees Celsius and y is a resistance in ohms, the slope is ohms per degree.
This is why the slope is the natural way to express a rate. A straight line says the rate does not change, and the slope is that constant rate. A curve has a different rate at every point, and finding the slope at a single point is a calculus problem rather than a coordinate geometry one.
Common Mistakes to Avoid
The errors that come up most often with the Slope Calculator are easy to spot once you know them:
- Mixing the order of subtraction between the numerator and the denominator. Using (y2 - y1) over (x1 - x2) gives the right size with the wrong sign. Keep both differences in the same direction.
- Subtracting x from y. The coordinates have to stay in their own axis. (2, 3) means x = 2 and y = 3, so the y-coordinate is the second number, not the first.
- Reporting a vertical line as a very steep slope. A run of zero has no answer, and the tool says undefined to avoid inventing one.
- Reading the table as swapped axes. On a standard graph the x-axis is horizontal and the y-axis is vertical, so the rise belongs on top of the fraction and the run underneath.
- Rounding the coordinates before the calculation. Keep the full values and let the tool round the slope at the end, or a two-decimal coordinate can move the answer by more than the rounding suggests.
- Treating a slope of zero as a missing answer. Zero is a result, and it describes a flat line.
- Entering a value in the wrong unit for the variable you want to solve for, if the Slope Calculator offers a reverse mode; the answer is only right when the unit matches the label.
- Treating the result as exact when the input coordinates themselves were estimates.
Limitations
The formula is exact for any two distinct points, and the answers above are exact rather than approximate. What limits the tool is everything the formula does not cover.
The calculator gives the slope of the straight line through the two points. If the underlying relationship is curved, that straight line is a chord, and its slope is an average rate of change rather than the rate at any particular point on the curve. For the rate at one point, use a tangent line calculation instead.
The arithmetic assumes the coordinates are numbers in a single unit system. Mixed units, such as one point in metres and the other in feet, produce a slope in mixed units that carries no meaning until you convert.
Precision is limited by floating-point arithmetic in the browser. For coordinates near the limits of what a double can represent, or for points extremely close together, the last displayed digit deserves caution. For school and everyday work the answers are reliable to the precision shown.
Quick Reference
| Item | Answer |
|---|---|
| Inputs | Two coordinate pairs, x1, y1, x2 and y2 |
| Rise | y2 minus y1 |
| Run | x2 minus x1 |
| Slope | Rise divided by run |
| Slope of zero | A horizontal line |
| Undefined slope | A vertical line, where the run is zero |
| Parallel lines | Equal slopes |
| Perpendicular lines | Slopes that multiply to -1, so a slope of 2 pairs with a slope of -0.5 |
| Units | The units of y divided by the units of x |
Frequently Asked Questions
What is the Slope Calculator for? It finds the slope of the straight line through two points, and reports the rise and the run alongside it. Use it for coordinate geometry homework, for checking a gradient read off a chart, and for turning two readings into a rate of change.
What if the two x values are the same? The run is then zero and the slope is undefined, because dividing by zero has no answer. The line is vertical, and its equation takes the form x = a constant. The points (3, 2) and (3, 9) in the examples above show the case.
What does a negative slope mean? It means y falls as x rises. The line runs down from left to right. In context it describes an inverse relationship, such as a balance that shrinks as time passes or a distance that closes as speed increases.
Is slope the same as gradient? Yes. Gradient is the term more common in British English and slope is the term more common in American English, and both name the same ratio of vertical change to horizontal change.
How do I find the angle the line makes with the x-axis? The tangent of the angle equals the slope. For a slope of 2, the angle is the arctangent of 2, which is 63.43 degrees. For a slope of 1 the angle is 45 degrees, and for a slope of -3 the angle is -71.57 degrees, the negative sign indicating that the line runs downward.
Can I use the result for professional or commercial purposes? Yes. The calculation is the standard definition of slope and is exact for the two points entered. For work where the result carries a legal, medical or financial consequence, treat it as a starting point and have the underlying measurements checked.
Related tools
- Slope Calculator
- Average Rate of Change Calculator
- Instantaneous Rate of Change Calculator
- Linear Regression Calculator
- Slope of Tangent Line Calculator
References
- Weisstein, E. W., "Slope", Wolfram MathWorld, the standard definition of the slope of a line. https://mathworld.wolfram.com/Slope.html
- Larson, R. & Edwards, B. (2018), Calculus, 11th ed., Cengage, for coordinate geometry and the two-point slope formula.