Slope Calculator

This calculator finds the slope of a line given two points. The slope (or gradient) measures the steepness and direction of a line. It is one of the most important concepts in analytic geometry and algebra. Enter the coordinates of two points, and the calculator returns the slope, the y-intercept, and the equation of the line in both slope-intercept form (y = mx + b) and standard form (ax + by = c). The tool also handles vertical lines (undefined slope) and horizontal lines (zero slope) correctly.

Point 1 (x1, y1)
Point 2 (x2, y2)

Slope formula

Given two points (x1, y1) and (x2, y2):
Slope (m) = (y2 - y1) / (x2 - x1) = rise / run

Once slope is known, find y-intercept (b) using:
b = y1 - m * x1

Slope-intercept form: y = mx + b

Slope: frequently asked questions

What is slope?

Slope (or gradient) measures the steepness of a line. It is calculated as rise over run: the change in y divided by the change in x. Slope = (y2 - y1) / (x2 - x1). A positive slope rises left to right, a negative slope falls left to right, zero slope is horizontal, and undefined slope is vertical.

How do I find the slope between two points?

Given two points (x1, y1) and (x2, y2), use the formula: slope = (y2 - y1) / (x2 - x1). Subtract the y-coordinates and divide by the difference of the x-coordinates.

What does an undefined slope mean?

An undefined slope occurs when the line is vertical (x1 = x2). In this case, the denominator (x2 - x1) is zero, and division by zero is undefined. Vertical lines have the same x-coordinate for all points.

What is the y-intercept?

The y-intercept is the point where the line crosses the y-axis (where x = 0). Once you know the slope and one point, you can find the y-intercept using the equation: y = mx + b, where b is the y-intercept.

How do I write the equation of a line given two points?

First, find the slope using (y2 - y1) / (x2 - x1). Then, use the point-slope form: y - y1 = m(x - x1). Simplify to get slope-intercept form: y = mx + b.

Methodology

Reviewed by the CalculatorHub team, edited by James Graham, 14 June 2026. See our methodology.