Slope & Line Calculator
Enter two points and get the slope m, the y-intercept b, and the line equation y = mx + b — with the full working and a graph.
About this calculator
Enter the coordinates of two points (x₁, y₁) and (x₂, y₂). The calculator finds the slope m = (y₂ − y₁) / (x₂ − x₁), the y-intercept b = y₁ − m·x₁, and the line in slope-intercept form. If x₁ = x₂ the line is vertical and its slope is undefined.
How to find the slope and equation of a line
The slope of a line through two points is the ratio of vertical change to horizontal change: m = (y₂ − y₁) / (x₂ − x₁), often called rise over run. Once you have m, the y-intercept follows from b = y₁ − m·x₁, and the line is written in slope-intercept form y = mx + b. A positive slope rises left to right, a negative slope falls, and a zero slope is a horizontal line. When the two points share the same x-coordinate, run is zero, the formula divides by zero, and the line is vertical — its slope is undefined and it is written x = constant.