AJ Designer

Slope Calculator

Slope m equals the change in y divided by the change in x.

Try a common slope

Point 1 (x₁, y₁)
Point 2 (x₂, y₂)

Solution

Share:

Slope Between Two Points

The slope m of a straight line through two points (x₁, y₁) and (x₂, y₂) is the change in y divided by the change in x — rise over run. It tells you how steeply the line climbs (positive slope) or falls (negative slope) for every unit of horizontal travel.

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

How It Works

Slope measures how steeply a line rises or falls as you move across it. The slope formula m = (y₂ − y₁) / (x₂ − x₁) takes the vertical change (rise, Δy) between two points and divides by the horizontal change (run, Δx). A larger absolute value means a steeper line; a positive value means the line goes up from left to right, a negative value means it goes down, and zero means the line is flat. When the two points share the same x-coordinate the formula divides by zero — the line is vertical and the slope is undefined.

Example Problem

Find the slope of the line through the points (1, 2) and (4, 8), and convert that slope to an angle from the horizontal and a percent grade.

  1. Label the points: (x₁, y₁) = (1, 2) and (x₂, y₂) = (4, 8). The order matters only in that you must subtract y and x in the same order.
  2. Find the rise: Δy = y₂ − y₁ = 8 − 2 = 6.
  3. Find the run: Δx = x₂ − x₁ = 4 − 1 = 3.
  4. Apply the slope formula: m = Δy / Δx = 6 / 3 = 2.
  5. Convert to an angle from the horizontal: θ = arctan(2) ≈ 63.43°.
  6. Convert to a percent grade: grade = m × 100 = 200%. The line rises 2 units for every 1 unit it advances, which is much steeper than a typical roadway or roof.

Swapping the order of the points does not change the answer — both numerator and denominator flip sign, and the negatives cancel: (2 − 8) / (1 − 4) = −6 / −3 = 2.

Key Concepts

Positive slope means the line rises from left to right; negative slope means it falls. A slope of zero is a horizontal line (no rise), and an undefined slope is a vertical line (no run — division by zero). Slope can be expressed three equivalent ways: as a pure ratio (m = 2), as an angle from the horizontal (θ = arctan m, so m = 2 corresponds to about 63.43°), and as a percent grade (m × 100, so m = 0.05 is a 5% grade). In calculus, slope generalises to the derivative — the slope of the tangent line at a single point on a curve.

Applications

  • Road and roof construction: percent grade describes road steepness (interstate maximum ≈ 6%) and roof pitch (e.g. a 4-in-12 pitch corresponds to a slope of 4/12 ≈ 0.333).
  • Wheelchair ramp design: the ADA Standards specify a maximum slope of 1:12 (≈ 4.76°, an 8.33% grade) for accessible ramps.
  • Topographic maps and gradient analysis: the slope between two contour points describes how steep terrain rises over horizontal distance — a key input for hiking, drainage, and erosion studies.
  • Business and economics: a revenue-vs-time slope is a growth rate; the slope of a cost curve is marginal cost. Many KPIs are explicitly slopes (dollars per day, signups per week).
  • Statistics and machine learning: the slope of a regression line summarises how strongly one variable moves with another, and is the most-reported coefficient in a linear model.

Common Mistakes

  • Subtracting in inconsistent order — using (y₂ − y₁) on top but (x₁ − x₂) on the bottom flips the sign. Always subtract both coordinates in the same direction.
  • Confusing slope (m) with the y-intercept (b). In y = m·x + b, the slope governs steepness; the intercept is where the line crosses the y-axis.
  • Treating an undefined slope as zero. A vertical line has undefined slope (no run); a horizontal line has slope 0 (no rise). They are opposite extremes, not the same case.
  • Reading slope only as a fraction. A slope of 2 also means a 200% grade and an angle of about 63°; switching units helps when comparing roads, roofs, or ramps.

Frequently Asked Questions

How do you calculate slope?

Pick two points on the line, (x₁, y₁) and (x₂, y₂), then divide the change in y by the change in x: m = (y₂ − y₁) / (x₂ − x₁). For example, the points (1, 2) and (4, 8) give m = (8 − 2) / (4 − 1) = 6 / 3 = 2. The result is the line's slope — a single number that describes its steepness and direction.

What is the slope formula?

The slope formula is m = (y₂ − y₁) / (x₂ − x₁), often summarised as 'rise over run'. The numerator is the vertical change between the two points, and the denominator is the horizontal change. The formula works for any two distinct points on a non-vertical straight line.

What is slope?

Slope is a number that measures how steeply a straight line rises or falls. Geometrically it is the tangent of the angle the line makes with the positive x-axis. A slope of 1 corresponds to a 45° line, a slope of 0 is horizontal, and an undefined slope is vertical.

How do you find slope from two points?

Subtract the y-coordinates of the two points (rise), subtract the x-coordinates in the same order (run), and divide. Symbolically, m = (y₂ − y₁) / (x₂ − x₁). The answer is independent of which point you label first as long as you subtract consistently in the numerator and denominator.

What is a negative slope?

A negative slope means the line falls from left to right — y decreases as x increases. For example, the line through (0, 5) and (5, 0) has slope (0 − 5) / (5 − 0) = −1, a 45° downhill. The more negative the value, the steeper the descent.

What is an undefined slope?

An undefined slope occurs when the two points have the same x-coordinate. The run x₂ − x₁ is zero, and dividing by zero is not defined. Geometrically the line is vertical, so it has no finite steepness — it climbs infinitely fast.

How is slope related to grade percentage?

Multiply the slope by 100 to get the percent grade. A slope of 0.05 is a 5% grade (a typical highway maximum), a slope of 0.0833 is the ADA wheelchair ramp limit of about 8.33% (1:12), and a slope of 1 is a 100% grade (45°). Engineers and builders use grade percentage because it is more intuitive than raw slope for shallow inclines.

How is slope related to the derivative in calculus?

For a curve, the derivative at a point is the slope of the tangent line at that point — the limiting case of the slope formula as the two points are brought together. For a straight line the derivative is constant and equals the slope; for a general curve the slope changes from point to point, which is exactly what the derivative captures.

Reference: Stewart, James. 2015. Calculus: Early Transcendentals. Cengage Learning. 8th ed.

Slope Formula

The slope of a non-vertical straight line through two points (x₁, y₁) and (x₂, y₂) is defined as the change in y divided by the change in x:

m = (y₂ − y₁) / (x₂ − x₁) = Δy / Δx

Where:

  • m — slope (dimensionless ratio); also called the gradient
  • x₁, y₁ — coordinates of the first point on the line
  • x₂, y₂ — coordinates of the second point
  • Δy = y₂ − y₁ — the rise (vertical change)
  • Δx = x₂ − x₁ — the run (horizontal change)

Two related quantities follow directly from the slope: θ = arctan(m) is the angle the line makes with the positive x-axis (in degrees), and the percent grade is m × 100.

Slope Diagram

Two points on a Cartesian plane with a right-triangle showing the rise (Δy) and run (Δx). The slope m equals rise over run.

Slope diagramA Cartesian plane with two points P1 at (1, 2) and P2 at (4, 8) connected by a straight line. A right triangle below the line shows the rise (Delta y) and run (Delta x) used to compute the slope m equals rise over run.yxΔx = x₂ − x₁Δy = y₂ − y₁P₁(x₁, y₁)P₂(x₂, y₂)m = Δy / Δx = rise / run

Worked Examples

Coordinate Geometry

What is the slope between (1, 2) and (4, 8)?

The reference example used throughout this page — two integer-coordinate points with a clean rise-over-run answer.

  • Identify the points: (x₁, y₁) = (1, 2), (x₂, y₂) = (4, 8).
  • Compute the rise: Δy = 8 − 2 = 6.
  • Compute the run: Δx = 4 − 1 = 3.
  • Slope: m = Δy / Δx = 6 / 3.

m = 2 (angle ≈ 63.43°, grade = 200%)

A slope of 2 is steep — much more than a typical roadway. Roads and ramps are usually expressed as a percent grade rather than a raw slope.

Accessibility Design

What is the slope of an ADA-compliant 1:12 wheelchair ramp?

The Americans with Disabilities Act caps accessible-ramp slope at 1 unit of rise per 12 units of run — the steepest gradient still considered safe for unassisted wheelchair use.

  • Set the run to 12 and the rise to 1: (x₁, y₁) = (0, 0), (x₂, y₂) = (12, 1).
  • Δy = 1 − 0 = 1, Δx = 12 − 0 = 12.
  • m = 1 / 12 ≈ 0.0833.
  • Angle: θ = arctan(0.0833) ≈ 4.76°.
  • Grade: 0.0833 × 100 ≈ 8.33%.

m ≈ 0.0833 (angle ≈ 4.76°, grade ≈ 8.33%)

Builders usually verify the ramp by measuring rise and run directly with a tape measure — the slope formula confirms the design meets the ADA limit.

Highway Engineering

What slope corresponds to a 6% highway grade?

U.S. interstate guidelines recommend a maximum sustained grade of about 6%. Translate that grade into a slope and an angle.

  • A 6% grade means a rise of 6 over a run of 100. Use (0, 0) and (100, 6).
  • Δy = 6, Δx = 100.
  • m = 6 / 100 = 0.06.
  • Angle: θ = arctan(0.06) ≈ 3.43°.

m = 0.06 (angle ≈ 3.43°, grade = 6%)

Mountain interstates occasionally exceed 6% on short sections, but anything over 7% triggers special signage and runaway-truck design rules.

Related Calculators

Related Sites