How to Calculate the Slope of a Line

Learn rise over run, y = mx + b, parallel and perpendicular slopes, and inclination angle — free slope calculator guide.

By Generatr Team

Slope measures how steep a straight line is: rise over run, or the change in y divided by the change in x. In symbols, between points (x₁, y₁) and (x₂, y₂): m = (y₂ − y₁) / (x₂ − x₁) when x₂ ≠ x₁.

This guide covers the two-point formula, slope-intercept and point-slope forms, parallel and perpendicular lines, inclination angle, and vertical/horizontal special cases. Compute m and line equations with the free slope calculator — two points, y = mx + b, parallel/perpendicular slopes, and angle client-side.

Segment centers use the midpoint guide; best-fit slopes through noisy data use the linear regression guide.

Free tool

Use the Slope Calculator now

Open the interactive slope calculator in your browser — free, instant, no signup.

Open Slope Calculator

What Is Slope as Rise Over Run?

From left to right on a graph:

  • Rise — vertical change Δy = y₂ − y₁
  • Run — horizontal change Δx = x₂ − x₁
  • Slope m — Δy / Δx

Positive m: line goes up as x increases. Negative m: line goes down. Zero m: horizontal. Undefined m: vertical (run = 0).

Worked examples

(1, 2) and (4, 8) → m = (8−2)/(4−1) = 6/3 = 2.

(0, 5) and (3, 5) → m = 0/3 = 0 (horizontal).

(2, 1) and (2, 9) → run = 0 → undefined (vertical line x = 2).

(−1, 4) and (3, −2) → m = (−2−4)/(3−(−1)) = (−6)/4 = −1.5.

Order of points cancels: swapping both endpoints multiplies numerator and denominator by −1. Confirm any pair in the free slope calculator.

Units matter in applications: if y is meters and x is seconds, m is meters per second (rate), not a pure geometric ratio without context.

How Do y = mx + b and Point-Slope Form Work?

Slope-intercept form: y = mx + b

  • m — slope
  • b — y-intercept (value of y when x = 0)

Point-slope form: y − y₁ = m(x − x₁) using any point on the line and the slope.

Convert point-slope to slope-intercept by expanding and isolating y. Example: through (2, 3) with m = 4 → y − 3 = 4(x − 2) → y = 4x − 5, so b = −5.

From two points: first find m, then plug one point into point-slope, then simplify. The free slope calculator typically returns both forms so you can match textbook style.

Standard form Ax + By = C is another packaging of the same line; solve for y to read m = −A/B when B ≠ 0.

Percent grades on roads are often (rise/run) × 100 — a percentage representation of slope. Converting a decimal slope 0.08 to 8% is a percent move; related change language appears in the percentage change guide when comparing two values over time rather than geometric rise/run.

How Do Parallel and Perpendicular Slopes Relate?

In the coordinate plane (non-vertical lines):

  • Parallel lines — equal slopes: m₁ = m₂
  • Perpendicular lines — slopes are negative reciprocals: m₂ = −1/m₁ (when m₁ ≠ 0)

Examples: slope 3 ∥ slope 3. Slope 3 ⊥ slope −1/3. Slope 2/5 ⊥ slope −5/2.

Horizontal (m = 0) is perpendicular to vertical (undefined). Two vertical lines are parallel to each other; “negative reciprocal” does not apply to undefined slopes in the usual fraction sense.

To write a line through point P parallel to a given line: copy m, use point-slope at P. For perpendicular: use −1/m (or vertical/horizontal swap), then point-slope at P.

Perpendicular bisectors combine midpoint and perpendicular slope — average the endpoints for the midpoint with the midpoint guide, then take −1/m through that point. The slope calculator often lists parallel and perpendicular slopes next to m so you can build those equations without hand arithmetic errors.

How Do You Find the Angle of Inclination from Slope?

The inclination angle θ (from the positive x-axis to the line, usually −90° < θ ≤ 90° in classroom settings) satisfies:

m = tan(θ)θ = arctan(m)

for non-vertical lines. Positive m → acute positive angle; negative m → angle below the x-axis (or the obtuse direction depending on convention — know which your course uses).

  • m = 1 → θ = 45°
  • m = 0 → θ = 0°
  • m = √3 → θ = 60°
  • vertical → θ = 90° (slope undefined; tan goes to infinity)

Calculators return arctan in radians or degrees — match the problem’s unit. Steep grades can have large |m| and θ near ±90° without ever being vertical.

The free slope calculator angle output should match arctan(m) for the same m you computed by hand. Physics ramps use the same tan relationship between height, length along base, and angle.

Do not confuse inclination of a line with the angle between two lines; that uses a formula with both slopes: tan φ = |(m₂ − m₁)/(1 + m₁m₂)| when 1 + m₁m₂ ≠ 0.

How Is Geometric Slope Different from Averages and Regression?

Two points define exactly one straight line and one slope m. Real data often has many points that do not lie on one perfect line.

  • Two-point slope — exact geometric ratio for a segment or ideal line
  • Average rate of change on [a, b] for a function — [f(b) − f(a)]/(b − a), same formula structure as slope of the secant
  • Linear regression slope — least-squares best-fit m through many (x, y) pairs; minimizes squared vertical residuals

If you only have two classroom points, use the slope formula. If you have a scatter plot of 20 measurements, use the linear regression calculator guide for best-fit m and b plus R².

Averaging y-values alone does not give slope. The average calculator guide is for means of lists, not rise/run. Midpoint of a segment is the average of coordinates — related arithmetic, different geometric object; see the midpoint calculator.

Always plot or sketch: a calculated m = 2 should look like “up 2, over 1” repeatedly along the line.

What Slope Mistakes Should You Avoid?

Common errors:

  • Δx / Δy instead of Δy / Δx — invert only when finding perpendicular reciprocal deliberately
  • Subtracting coordinates in inconsistent order — keep (y₂ − y₁) over (x₂ − x₁) with the same point indexing
  • Calling vertical slope “zero” — zero is horizontal; vertical is undefined
  • Using m₁ = m₂ for perpendicular — that is parallel
  • Forgetting negative signs on coordinates in quadrant III/IV
  • Reducing fractions incorrectly after computing rise and run

On graphs without labeled scales, count grid units carefully. On tables, pick any two distinct x-rows; for a true linear table all pairs share one m — if not, the relation is not linear (or data has error).

Percent language (“increased 20%”) is not the same as slope 0.20 unless x is scaled so that a 1-unit run matches that interpretation. Use the percentage change calculator for relative change between two numbers, and the free slope calculator for coordinate geometry.

How Do You Use Generatr’s Slope Calculator?

Enter two points or slope parameters; read m and equations.

  1. Open the free slope calculator.
  2. Enter (x₁, y₁) and (x₂, y₂).
  3. Read m = rise/run and note undefined cases for vertical lines.
  4. Review slope-intercept and point-slope forms when provided.
  5. Note parallel slope (same m) and perpendicular slope (−1/m).
  6. Read the inclination angle from arctan(m) if offered.
  7. Write the line through a third point using the returned m.
  8. For many noisy points, switch to the linear regression calculator.

Related tools: midpoint calculator, average calculator, and percentage change calculator.

Step-by-Step Instructions

  1. 1Open the free slope calculator on Generatr.
  2. 2Write down the two points (x₁, y₁) and (x₂, y₂).
  3. 3Compute rise y₂ − y₁ and run x₂ − x₁.
  4. 4Divide rise by run to get m (flag undefined if run is 0).
  5. 5Enter both points into the calculator to confirm m.
  6. 6Build y − y₁ = m(x − x₁) or y = mx + b as required.
  7. 7Find parallel (same m) or perpendicular (−1/m) slopes when needed.
  8. 8Optionally convert m to an inclination angle with arctan(m).

Frequently Asked Questions

What is the slope formula for two points?+

m = (y₂ − y₁) / (x₂ − x₁) when x₂ ≠ x₁. That is rise over run. If x₂ = x₁, the line is vertical and slope is undefined.

What does a negative slope mean?+

As x increases, y decreases. On a graph the line falls from left to right. Example: m = −2 means down 2 units for each 1 unit right.

How do you find the slope in y = mx + b?+

The coefficient m is the slope; b is the y-intercept. In y = −3x + 7, the slope is −3 and the line crosses the y-axis at 7.

What is the slope of a perpendicular line?+

If a non-vertical, non-horizontal line has slope m, a perpendicular line has slope −1/m. Horizontal lines (m = 0) are perpendicular to vertical lines.

How is slope related to the angle of a line?+

m = tan(θ), where θ is the inclination angle from the positive x-axis. So θ = arctan(m) for finite slopes, with attention to degree vs radian mode.

Is Generatr’s slope calculator free?+

Yes. Compute slope from two points, line equations, parallel/perpendicular slopes, and angle in your browser without an account.

Ready to try it yourself?

Use the free Slope Calculator — no download, no account.

Launch Slope Calculator