Skip to content
NumberCalculator365

Slope Calculator

Find the slope of the line through two points (x₁, y₁) and (x₂, y₂). Slope is rise over run: m = (y₂ − y₁) / (x₂ − x₁). The page also reports the slope-intercept equation, y-intercept, angle with the positive x-axis, distance between the points, and the midpoint.

Slope Calculator tool

About the Slope Calculator

If x₁ = x₂ and the y-values differ, the line is vertical: slope is undefined and the equation is x = x₁. If the two points are identical, slope is undefined in a different way and the form shows an error instead of 0/0.

This is Cartesian slope, not roof pitch as a percent grade and not a triangle solver. Use the triangle calculator for SSS/SAS sides and angles. Use the scientific calculator if you already know m and need arctangent yourself.

How the Slope Calculator works

m = Δy / Δx. The intercept b in y = mx + b is y₁ − m x₁. Distance is √(Δx² + Δy²). Midpoint is the average of each coordinate. Angle is arctan(m) in degrees, or ±90° when the line is vertical.

m = (y₂ − y₁) / (x₂ − x₁),  x₂ ≠ x₁
y = mx + b,  b = y₁ − m x₁
distance = √((x₂ − x₁)² + (y₂ − y₁)²)

Example

Through (1, 2) and (4, 8), m = 6/3 = 2 and y = 2x.

How to Use the Slope Calculator

  1. Enter x₁, y₁, x₂ and y₂.
  2. Read m, or “undefined” for a vertical line.
  3. Use the equation to sketch y = mx + b when the line is non-vertical.
  4. Distance and midpoint describe the segment between the points, not a third point.
  5. Open the triangle calculator if you have side lengths instead of coordinates.

Slope Calculator Examples

Positive slope

(1, 2) to (4, 8): rise 6, run 3, m = 2, intercept 0, equation y = 2x.

Negative slope

(0, 4) to (2, 0): m = −2, equation y = −2x + 4.

Horizontal

(3, 5) to (10, 5): m = 0, equation y = 5.

Vertical

(3, 1) to (3, 5): slope undefined, equation x = 3, angle ±90°.

How to Find Slope From Two Points

Subtract y-values to get rise. Subtract x-values to get run. Divide rise by run. Order the points consistently: (y₂ − y₁) over (x₂ − x₁). Swapping both points does not change m. Swapping only one coordinate pair would be a different line. Reduce rise/run like a fraction if you want an exact ratio; the result panel already shows rise and run separately. That is the “slope calculator” and “slope from two points” method taught in US algebra.

Slope-intercept form

Once m is known, b = y₁ − m x₁. For (1, 2) and m = 2, b = 2 − 2×1 = 0, so y = 2x. A horizontal line has m = 0 and equation y = that constant. A vertical line cannot be written as y = mx + b; the tool prints x = x₁ instead. Point-slope form y − y₁ = m(x − x₁) is the same line and is not printed as a separate field.

Slope examples

Positive m rises left to right. Negative m falls. Zero is horizontal. Undefined is vertical. Distance is the length of the segment, useful in coordinate geometry but not required to report slope.

Two-point slope checks
PointsmEquation
(1, 2), (4, 8)2y = 2x
(0, 4), (2, 0)−2y = −2x + 4
(3, 5), (10, 5)0y = 5
(3, 1), (3, 5)undefinedx = 3
(−2, 1), (2, 3)0.5y = 0.5x + 2

Slope versus triangle angles

The angle this page reports is the inclination of the line, not an interior angle of a triangle. If you have three side lengths or two sides and a non-included angle, use the triangle calculator (SSS, SAS, ASA, AAS, SSA). The scientific calculator can take arctan of a slope you already have if you need more decimal places in a different mode (degrees versus radians).

Frequently Asked Questions

What if the points are the same?

Slope is undefined. The calculator shows an error rather than 0/0.

What does undefined mean?

A vertical line has zero run. It has no finite slope and no y-intercept in slope-intercept form.

Is the angle a compass bearing?

No. It is arctangent of m in degrees from the positive x-axis, between −90° and 90° for non-vertical lines.

Does this do percent grade?

No. Percent grade is 100 × rise/run as a percentage. You can compute that from the rise and run items, but the main result is m as a number.

Can I enter decimals?

Yes. Coordinates may be any finite numbers.

Is this a triangle calculator?

No. It does not solve SSS or SAS. It only uses two Cartesian points.

Guides that use this calculator