Slope Calculator
Find the slope and equation of the line through two points
How Slope and the Line Equation Are Calculated
The slope of a line measures how steeply it rises or falls as you move from left to right. Given two points on a line, (x₁, y₁) and (x₂, y₂), the slope m is the ratio of the vertical change to the horizontal change between them: m = (y₂ − y₁) / (x₂ − x₁). This ratio is often described as rise over run. A positive slope means the line climbs from left to right, a negative slope means it falls, and a slope of zero means the line is perfectly horizontal.
Once you know the slope, you can write the full equation of the line in slope-intercept form, y = mx + b, where b is the y-intercept, the point where the line crosses the vertical axis. To find b, substitute the slope and the coordinates of either known point into the equation and solve: b = y₁ − m times x₁. The calculator above performs this substitution automatically after computing the slope, so you get both the numeric slope and the complete equation of the line in one step, without doing the algebra by hand.
One case falls outside this formula: when both points share the same x-coordinate, the line between them is vertical. A vertical line rises infinitely for zero horizontal change, so its slope is undefined rather than a number, and it cannot be written as y = mx + b. Instead, a vertical line is described directly by its x-coordinate, such as x = 4. The calculator recognizes this case and reports it instead of dividing by zero.
