Skip to content

Slope Calculator

Enter two points to find the slope of the line through them, shown as an exact fraction, along with the equation of the line, its intercepts, the angle and the distance.

Free, no sign-up · Last updated

US defaults ·

Slope (m) through (2, 3) and (5, 5)

2/3

Equation
y = (2/3)x + 5/3
As a decimal
0.666667
Rise (y₂ − y₁)2
Run (x₂ − x₁)3
Slope-intercept formy = (2/3)x + 5/3
Point-slope formy − 3 = (2/3)(x − 2)
Standard form2x − 3y = −5
y-intercept(0, 5/3)
x-intercept(−2.5, 0)
Angle with the x-axis33.6901°
Grade (slope as a percentage)66.6667%
Distance between points3.605551
Midpoint(3.5, 4)

A positive slope rises from left to right.

Definition

What slope means

Slope is the change in a line’s vertical coordinate divided by the change in its horizontal coordinate. It tells you how much the line rises or falls per unit to the right. A horizontal line has zero slope and a vertical line has undefined slope.

Find it from
Vertical change divided by horizontal change
Negative slope
The line falls as x increases
Vertical line
Zero run gives undefined slope

What slope measures

Slope is the steepness of a line: how much it goes up (or down) for each step to the right. A slope of 2 rises 2 units for every 1 across; a slope of 1/4 rises 1 unit for every 4 across. Because it is a ratio, the slope is the same between any two points on a straight line, which is what makes a line straight.

Outside maths class, slope appears as the pitch of a roof, the gradient of a road or railway, the fall of a drainage pipe, and the rate of change in a graph, such as speed on a distance-time chart or price per unit on a cost chart.

How to use the calculator

Enter the coordinates of two points, (x₁, y₁) and (x₂, y₂). The result shows the slope as a fraction and as a decimal, the equation of the line in three forms, where it crosses each axis, its angle and grade, the distance between the two points and the midpoint.

If you have the slope and one point rather than two points, you can still use it: pick a second point by moving one step along. For a slope of 3 through (1, 2), the point (2, 5) is also on the line.

A worked example

Take the points (−1, 4) and (3, −2). The rise is −2 − 4 = −6 and the run is 3 − (−1) = 4, so the slope is −6/4 = −3/2. The line falls 3 units for every 2 across.

For the intercept, use y = mx + b with the first point: 4 = (−3/2)(−1) + b, so b = 4 − 3/2 = 5/2. The equation is y = (−3/2)x + 5/2. It crosses the x-axis where y = 0, at x = 5/3 ≈ 1.6667. The midpoint of the two points is (1, 1) and the distance between them is √(4² + 6²) = √52 ≈ 7.2111.

Slope in the real world

Builders and engineers usually give slope as a ratio or a percentage. A road sign showing a 6% grade means the road rises 6 m for every 100 m across, an angle of about 3.43°. Roof pitch is often written as rise over a run of 12, so a 6-in-12 roof has a slope of 0.5, about 26.57°.

For a sloped length such as a ramp or a rafter, the distance between the two points is the length you need, and it comes from the Pythagorean theorem. The Pythagorean theorem calculator works this out for any right triangle.

Parallel and perpendicular lines

Parallel lines have the same slope, so y = 2x + 1 and y = 2x − 4 never meet. Perpendicular lines have slopes that multiply to −1: the perpendicular to a line of slope 2/3 has slope −3/2. This is how you find the line at right angles to another through a given point, and how you check whether two sides of a shape are square.

To see the line drawn, type its equation into the graphing calculator.

Step-by-step example

Find the slope and other properties of the line through (−1, 4) and (3, −2).

StepResult
Rise−6
Run4
Slope−3/2
y-intercept5/2
Equationy = (−3/2)x + 5/2
Midpoint(1, 1)
Distance between points7.2111

Formulas used

Slope

m = (y₂ − y₁) ÷ (x₂ − x₁)

m
slope
x₁
first point’s x-coordinate
y₁
first point’s y-coordinate
x₂
second point’s x-coordinate
y₂
second point’s y-coordinate

Example: (2, 3) and (5, 5): m = (5 − 3) ÷ (5 − 2) = 2/3.

Equation of the line

y = mx + b, where b = y₁ − m × x₁

Point-slope form: y − y₁ = m(x − x₁)

x
horizontal coordinate
y
vertical coordinate
m
slope
b
y-intercept
x₁
known point’s x-coordinate
y₁
known point’s y-coordinate

Example: b = 3 − (2/3) × 2 = 5/3, so y = (2/3)x + 5/3, or 2x − 3y = −5 in standard form.

Angle, distance and midpoint

Angle = arctan(m)

Distance = √((x₂ − x₁)² + (y₂ − y₁)²)

Midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)

m
slope
arctan
inverse tangent
x₁
first point’s x-coordinate
y₁
first point’s y-coordinate
x₂
second point’s x-coordinate
y₂
second point’s y-coordinate

Example: For (2, 3) and (5, 5): angle = arctan(2/3) = 33.69°, distance = √13 ≈ 3.6056, midpoint = (3.5, 4).

When the answer can mislead

  • Subtract the coordinates in the same point order to keep the sign correct.
  • A steep-looking line can have a modest slope if the axes use different scales.
  • For a curved graph, slope between two points gives an average change over that interval.

Questions

What is the slope formula?

Slope m = (y₂ − y₁) ÷ (x₂ − x₁): the change in y divided by the change in x between two points, often called rise over run. Through (2, 3) and (5, 5), the rise is 5 − 3 = 2 and the run is 5 − 2 = 3, so the slope is 2/3. It does not matter which point you call the first, as long as you keep x and y from the same point together.

How do I find the equation of a line from two points?

Find the slope m, then put one point into y = mx + b to get b. For (2, 3) and (5, 5), m = 2/3, and 3 = (2/3) × 2 + b gives b = 3 − 4/3 = 5/3. The equation is y = (2/3)x + 5/3. Multiplying through by 3 and rearranging gives the standard form 2x − 3y = −5.

What does a negative, zero or undefined slope mean?

A positive slope rises from left to right and a negative slope falls. A slope of 0 is a horizontal line, such as y = 5. When both points have the same x, the run is zero and the slope is undefined, because you cannot divide by zero; that is a vertical line, such as x = 3.

How do I turn a slope into an angle or a percentage grade?

The angle with the x-axis is the inverse tangent of the slope: a slope of 2/3 is arctan(0.6667) = 33.69°. The grade is the slope × 100%, so 2/3 is a 66.67% grade. A wheelchair ramp at the usual 1 : 12 maximum has a slope of 0.0833, an 8.33% grade, or an angle of 4.76°.

What are the slope-intercept, point-slope and standard forms?

They are three ways to write the same line. Slope-intercept form, y = mx + b, shows the slope and where the line crosses the y-axis. Point-slope form, y − y₁ = m(x − x₁), uses the slope and one known point. Standard form, Ax + By = C, uses whole numbers and works for vertical lines too.

Can I enter decimals and negative numbers?

Yes. Coordinates can be negative or have decimals. When the inputs have up to six decimal places the slope and intercept are shown as exact fractions, so (0.5, 1) and (1.5, 1.25) give a slope of 1/4 and an intercept of 7/8. With more decimals the results are shown as decimals.

Last updated How we check
Embed this calculator
Cite this calculator

Slope Calculator. CalculatorLab. https://calculatorlab.site/calculators/slope-calculator/. Last updated .