Toolzent

Slope Calculator

Free slope calculator: enter two points to find the slope of a line, slope-intercept equation y = mx + b, distance and midpoint — with every step shown.

Updated 2026-06-09 · Free · No sign-up · Runs privately in your browser

What is a slope calculator?

A slope calculator finds how steep a straight line is between two points, then reports its slope, its slope-intercept equation, the distance between the points, and their midpoint. You enter two coordinate pairs — (x₁, y₁) and (x₂, y₂) — and the tool returns the slope m, the equation y = mx + b, the straight-line distance, and the midpoint in one step.

Slope (sometimes called gradient) measures the rate at which y changes as x changes. A positive slope rises from left to right, a negative slope falls, a slope of 0 is horizontal, and a vertical line has an undefined slope. This slope calculator handles all four cases automatically.

How does the slope calculator work?

The core method is rise over run — the change in y divided by the change in x:

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

Once it has the slope, the tool finds the y-intercept b by rearranging the line equation and substituting the first point:

b = y₁ − m·x₁

That gives the full slope-intercept form, y = mx + b. Alongside this, two more standard formulas are evaluated:

  • Distance (straight-line length of the segment): distance = √((x₂ − x₁)² + (y₂ − y₁)²)
  • Midpoint (center of the segment): ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)

Terms and units

  • x₁, y₁ / x₂, y₂ — the coordinates of your two points. They can be whole numbers, decimals or negatives.
  • m (slope) — a unitless ratio. A slope of 3 means y increases by 3 for every 1 unit x increases.
  • b (y-intercept) — the value of y where the line crosses the y-axis (where x = 0).
  • Distance — measured in the same units as your axes.

If both x-values are equal, x₂ − x₁ is 0. Dividing by zero is not allowed, so the line is vertical and its slope is reported as undefined.

Examples

Example 1: Points (1, 2) and (4, 11)

  • Slope: m = (11 − 2) ÷ (4 − 1) = 9 ÷ 3 = 3
  • y-intercept: b = 2 − 3·1 = −1
  • Equation: y = 3x − 1
  • Distance: √((4 − 1)² + (11 − 2)²) = √(9 + 81) = √90 ≈ 9.487
  • Midpoint: ((1 + 4) ÷ 2, (2 + 11) ÷ 2) = (2.5, 6.5)

Example 2: Points (0, 1) and (2, 5)

  • Slope: m = (5 − 1) ÷ (2 − 0) = 4 ÷ 2 = 2
  • y-intercept: b = 1 − 2·0 = 1
  • Equation: y = 2x + 1
  • Distance: √((2 − 0)² + (5 − 1)²) = √(4 + 16) = √20 ≈ 4.472
  • Midpoint: ((0 + 2) ÷ 2, (1 + 5) ÷ 2) = (1, 3)

Example 3: Points (−2, 3) and (4, 0)

  • Slope: m = (0 − 3) ÷ (4 − (−2)) = −3 ÷ 6 = −0.5
  • y-intercept: b = 3 − (−0.5)·(−2) = 3 − 1 = 2
  • Equation: y = −0.5x + 2
  • Distance: √((4 − (−2))² + (0 − 3)²) = √(36 + 9) = √45 ≈ 6.708
  • Midpoint: ((−2 + 4) ÷ 2, (3 + 0) ÷ 2) = (1, 1.5)

You can reproduce any of these by typing the coordinates into the calculator above and pressing Calculate.

Slope reference table

This table shows how the value of m describes the direction and steepness of a line.

Slope (m)Direction of lineMeaning
m greater than 1Rises steeply left to righty grows faster than x
m = 1Rises at 45°y changes 1 for every 1 in x
0 less than m less than 1Rises gentlyy grows slower than x
m = 0Horizontaly never changes
m less than 0Falls left to righty decreases as x increases
undefinedVerticalx never changes; run is 0

Common uses

  • Algebra and geometry homework — finding the equation of a line, checking whether two lines are parallel (equal slopes) or perpendicular (slopes that multiply to −1).
  • Graphing — once you know m and b, you can plot the line directly from y = mx + b.
  • Physics and rates — slope on a distance-time graph is speed; on a velocity-time graph it is acceleration.
  • Construction and roads — slope expresses grade or pitch, the ratio of vertical rise to horizontal run.
  • Data and trends — the slope of a trend line shows how fast one quantity changes relative to another.

Tips and common mistakes

  • Keep the subtraction order consistent. Subtract the y-values in the same order you subtract the x-values. (11 − 2) ÷ (4 − 1) is correct; mixing the order, such as (11 − 2) ÷ (1 − 4), flips the sign.
  • Rise over run, not run over rise. Slope is the change in y on top and the change in x on the bottom — never the other way around.
  • Watch the negatives. Subtracting a negative coordinate adds, as in 4 − (−2) = 6. This is the most common arithmetic slip.
  • Zero slope vs. undefined slope. A horizontal line has slope 0 (run is fine, rise is 0). A vertical line is undefined (run is 0, so you would divide by zero). They are not the same thing.
  • Don’t confuse b with the x-intercept. b is where the line crosses the y-axis, found from b = y₁ − m·x₁.

Limitations and notes

This tool works with straight lines defined by two distinct points in a 2-D coordinate plane. If you enter the same point twice, there is no unique line and no defined slope. When the two x-values match, the result is a vertical line with an undefined slope, so the slope-intercept equation y = mx + b does not exist for it (although the distance and midpoint still do).

Decimal results are rounded for display, so a value such as √90 is shown as an approximation (≈ 9.487) rather than its exact irrational form. For graded coursework, follow the rounding and notation rules your instructor or specification requires.

This calculator is an educational and reference tool. Double-check results when accuracy is critical.

Explore more in percentage tools or browse the full math calculators collection.

Frequently asked questions

How do you find the slope from two points?+

Subtract the y-values and divide by the difference of the x-values: m = (y₂ − y₁) ÷ (x₂ − x₁). It is rise over run between the two points.

What is slope-intercept form?+

Slope-intercept form is y = mx + b, where m is the slope and b is the y-intercept. This calculator finds b with b = y₁ − m·x₁ after computing the slope.

What does a slope of zero mean?+

A slope of zero means the line is perfectly horizontal: the y-value never changes as x changes, so rise over run is 0 ÷ run = 0.

Why is the slope of a vertical line undefined?+

A vertical line has the same x-value at both points, so x₂ − x₁ = 0. Dividing by zero is undefined, so the slope is reported as undefined rather than a number.

How is the distance between two points calculated?+

Distance uses the Pythagorean theorem: distance = √((x₂ − x₁)² + (y₂ − y₁)²), the straight-line length of the segment joining the points.

What is the midpoint of two points?+

The midpoint is the average of the coordinates: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2). It marks the exact center of the segment between the two points.

Does the order of the two points matter?+

No. As long as you subtract the y-values and x-values in the same order, the slope comes out the same; swapping both points gives an identical result.