Free tool
Slope calculator, from two points, with the graph.
Type two points to get the slope as rise over run, plus the angle, distance, midpoint, the equation of the line in slope-intercept, point-slope and standard form, the x and y intercepts and a drawn graph. You can also find the slope from an equation, build a line from a point and a slope, or get the parallel and perpendicular lines through a point.
What to find
Type whole numbers, decimals like 2.5 or fractions like 1/2.
Worked out in your browser. Nothing is sent anywhere.
Guide
How to calculate slope, with worked examples.
To calculate slope, divide the rise by the run: the change in y between two points over the change in x. This slope calculator takes two points and gives the slope as an exact fraction, plus the angle, distance, midpoint, the equation of the line in three forms, both intercepts and a graph. It also finds the slope from an equation and the parallel and perpendicular lines through a point.
How to use the slope calculator
- Choose Two points, From an equation, Point and slope or Parallel and perpendicular.
- For two points, type Point 1: x and y, then Point 2: x and y. Decimals and fractions such as 1/2 work.
- Read the big Slope card first. The cards below give the rise, run, angle, distance, midpoint and intercepts, then the three equation forms.
- The graph shows both points, the line and the rise and run as a dashed triangle. Steps follow with the arithmetic.
- Swap the points checks that the slope does not change. Copy result and Copy link share what you found.
The slope formula
m = (y₂ − y₁) ÷ (x₂ − x₁). The top is the rise and the bottom is the run. A positive slope climbs as you go right, a negative slope falls, a slope of 0 is a flat line and a vertical line has no slope, because its run is 0 and you cannot divide by 0.
Worked example: two points
Take (2, 3) and (6, 11). The rise is 11 − 3 = 8 and the run is 6 − 2 = 4, so m = 8 ÷ 4 = 2. The y-intercept is b = 3 − 2 × 2 = −1, so the line is y = 2x − 1. Check with the other point: 2 × 6 − 1 = 11. The angle is arctan 2 = 63.43°. The distance is √(4² + 8²) = √80 = 4√5 ≈ 8.944, and the midpoint is (4, 7).
The three forms of a line
- Slope-intercept: y = mx + b. Here y = 2x − 1.
- Point-slope: y − y₁ = m(x − x₁). Here y − 3 = 2(x − 2).
- Standard: Ax + By = C with whole numbers, A not negative and no common factor. Here 2x − y = 1.
A negative and a fractional slope
For (1, 5) and (4, −1) the rise is −1 − 5 = −6 and the run is 3, so m = −2 and the line falls. Point-slope form is y − 5 = −2(x − 1), which becomes y = −2x + 7. For (0, 1) and (3, 3) the slope is 2/3. The calculator keeps it as a fraction, y = (2/3)x + 1, and gives the standard form 2x − 3y = −3 and the x-intercept at −3/2. Switch to a decimal in your head with 2 ÷ 3 = 0.6667.
Slope from an equation, or from a point and a slope
In y = 3x − 4 the slope is 3, the number in front of x. For 2x + 4y = 8 the slope is −A ÷ B = −2 ÷ 4 = −1/2, and b = C ÷ B = 8 ÷ 4 = 2, so the line is y = (−1/2)x + 2. Choose From an equation and type A, B and C. If you know a point and the slope, choose Point and slope: through (1, 2) with m = 3, y − 2 = 3(x − 1), which is y = 3x − 1. Type the word undefined as the slope to get a vertical line.
Horizontal and vertical lines
(1, 4) and (6, 4) give a rise of 0, so m = 0 and the line is y = 4. (3, 1) and (3, 7) give a run of 0, so the slope is undefined and the line is x = 3. A vertical line has an x-intercept but, unless it is the y axis, no y-intercept.
Slope as an angle and a grade
The angle with the x axis is arctan(m). A slope of 1/2 is 26.57°. Percent grade is the slope times 100: a rise of 1 over a run of 12 is 1/12 = 8.33%, or 4.76°. Roads and ramps are often described this way.
Parallel and perpendicular lines
Parallel lines have the same slope. Perpendicular lines have slopes that multiply to −1, the negative reciprocal: if m = 2 the perpendicular slope is −1/2. Choose Parallel and perpendicular, give the line with two points and a through point Q, and both new equations appear on the graph.
Common problems
- The same point twice. One point gives no line. The calculator asks you to change one.
- Mixing up the order. Subtract in the same order on top and bottom. Swapping the points gives the same slope.
- Graph looks flat. The graph uses the same scale on both axes, so a slope of 0.1 does look nearly flat.
To plot a function use the graphing calculator, for fractions the fraction calculator, and for converting an angle or unit the unit converter.
Questions
Good to know.
How do I calculate the slope between two points?
Subtract the y values and the x values in the same order, then divide: m = (y2 − y1) ÷ (x2 − x1). From (2, 3) to (6, 11) it is 8 ÷ 4 = 2.
What does a slope of 0 mean?
The line is flat. The y value does not change, so the equation is y equal to a number.
What is the slope of a vertical line?
Undefined. The run is 0 and you cannot divide by 0. The equation is x equal to a number.
How do I find the slope from an equation?
If it is y = mx + b, the slope is the number in front of x. For Ax + By = C, the slope is −A ÷ B. Choose From an equation and type the numbers.
How do I find a perpendicular slope?
Flip the slope and change its sign. A slope of 3 becomes −1/3, and a slope of −2/5 becomes 5/2.
Can the slope be a fraction?
Yes. The calculator keeps it exact, so 2/3 stays 2/3, and shows the decimal next to it.
How do I turn a slope into an angle?
Take the arctan of the slope. A slope of 1 is 45 degrees. The calculator shows degrees and radians.
Is anything sent anywhere?
No. It all runs in your browser, and your last numbers are remembered on this device only.