Slope Calculator

Find slope, distance, midpoint, angle, and line equation from two points.

Results

Slope (m)-
Distance-
Midpoint-
Angle of Inclination-
Line Equation-
Y-Intercept (b)-

What is a Slope Calculator?

A slope calculator measures the steepness and direction of the straight line passing through two points on a coordinate plane. Enter the coordinates of any two points and this tool returns the slope (m), the distance between the points, the midpoint, the angle of inclination, the y-intercept, and the equation of the line in slope-intercept form.

Slope — rise over run — tells you how quickly one quantity changes relative to another; for the straight-line length between two points, use our distance calculator.

The Slope Formula

Given two points (x₁, y₁) and (x₂, y₂), the slope of the line through them is:

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

  • m — the slope of the line
  • (x₁, y₁) — the coordinates of the first point
  • (x₂, y₂) — the coordinates of the second point
  • y₂ − y₁ — the vertical change, often called the rise
  • x₂ − x₁ — the horizontal change, often called the run

It does not matter which point you label first, as long as you subtract in the same order on top and bottom. If the run x₂ − x₁ is zero, the line is vertical and its slope is undefined.

Worked Example: Line Through (2, 3) and (6, 11)

Step 1: Apply the slope formula

Substitute the coordinates: m = (11 − 3) / (6 − 2) = 8 / 4 = 2. The line rises 2 units for every 1 unit of run.

Step 2: Solve for the y-intercept

Plug the slope and one point into slope-intercept form y = mx + b. Using (2, 3): 3 = 2(2) + b, so 3 = 4 + b and b = −1. Verify with the second point (6, 11): 2(6) − 1 = 12 − 1 = 11 ✓.

Step 3: Write the equation of the line

The slope-intercept equation is y = 2x − 1. In point-slope form, y − y₁ = m(x − x₁), the same line is y − 3 = 2(x − 2), which simplifies back to y = 2x − 1.

Enter these two points in the calculator above and it reports slope 2.0000, y-intercept −1.0000, line equation y = 2.0000x − 1.0000, distance 8.9443, midpoint (4, 7), and an angle of inclination of 63.43°.

Positive, Negative, Zero, and Undefined Slopes

The sign of the slope tells you which way the line travels; zero and undefined describe flat and vertical lines.

TypeSlopeExample PointsCalculationLine Behavior
Positivem > 0(1, 2) and (3, 8)m = (8 − 2)/(3 − 1) = 3Rises left to right
Negativem < 0(0, 5) and (5, 0)m = (0 − 5)/(5 − 0) = −1Falls left to right
Zerom = 0(2, 4) and (7, 4)m = (4 − 4)/(7 − 2) = 0Horizontal line, y = 4
Undefinedno value(3, 1) and (3, 6)m = (6 − 1)/(3 − 3) = 5/0Vertical line, x = 3

Zero slope and undefined slope are easy to confuse: a zero slope means zero rise (horizontal line, y = c), while an undefined slope means zero run — the formula divides by zero and the line is vertical (x = c). The calculator detects this case automatically and reports an undefined slope with a 90° angle.

Slope as a Percent Grade

Road signs, wheelchair ramps, and roof designs express steepness as a percent grade rather than a fraction: grade = (rise / run) × 100. A 6% road grade means the highway climbs 6 feet for every 100 feet of horizontal distance — a slope of 0.06. A ramp that rises 2 feet over a 25-foot run has a grade of (2/25) × 100 = 8%.

Parallel and Perpendicular Lines

Two lines are parallel exactly when their slopes are equal. The lines y = 2x − 1 and y = 2x + 5 are parallel because both have slope 2 — they rise at the same rate and never intersect.

Two lines are perpendicular when their slopes are negative reciprocals: if one line has slope m, the other has slope −1/m, and the product of the two slopes is −1. A line perpendicular to y = 2x − 1 therefore has slope −1/2. The perpendicular line through (6, 11) is y − 11 = −1/2(x − 6), which simplifies to y = −0.5x + 14 — check: −0.5(6) + 14 = −3 + 14 = 11 ✓. A horizontal line (m = 0) and a vertical line are always perpendicular.

How to Use

  1. Enter the coordinates for Point 1 (x₁, y₁)
  2. Enter the coordinates for Point 2 (x₂, y₂).
  3. Click Calculate to view all geometric properties.

The results panel also shows the distance between your points, their midpoint, the angle of inclination, the line equation, and the y-intercept.

Frequently Asked Questions

How do you calculate slope from two points?

Divide the rise by the run: m = (y₂ − y₁) / (x₂ − x₁). For example, the line through (2, 3) and (6, 11) has slope m = (11 − 3) / (6 − 2) = 8 / 4 = 2.

What does an undefined slope mean?

An undefined slope occurs when x₁ equals x₂, meaning the line is perfectly vertical. The run is zero, so the slope formula divides by zero. A vertical line is written as x = c, such as x = 3.

What is the slope-intercept form?

It is y = mx + b, where m is the slope and b is the y-intercept, the point where the line crosses the y-axis. The line through (2, 3) and (6, 11) has the equation y = 2x − 1.

What is the difference between point-slope and slope-intercept form?

Point-slope form, y − y₁ = m(x − x₁), builds the equation from the slope and one known point; slope-intercept form, y = mx + b, shows the y-intercept directly. Both describe the same line: y − 3 = 2(x − 2) simplifies to y = 2x − 1.

How is the angle of inclination calculated?

It is arctan(|m|) converted from radians to degrees — the acute angle between the line and the x-axis. A slope of 2 gives about 63.43°, and a vertical line has an angle of 90°.

How do I convert slope to a percent grade?

Multiply the slope by 100. A slope of 0.06 is a 6% grade — the surface rises 6 feet for every 100 feet of horizontal run. Percent grade is common on road signs, ramps, and roofs.

What slopes do parallel and perpendicular lines have?

Parallel lines share the same slope: y = 2x − 1 and y = 2x + 5 both have slope 2. Perpendicular lines have negative reciprocal slopes (product −1): a line with slope 2 is perpendicular to any line with slope −1/2, such as y = −0.5x + 14.

Can I use decimal or negative coordinates?

Yes, decimal and negative values are fully supported; every result is computed locally in your browser.