698 tools
All

Line Slope Calculator

Calculate the slope and y-intercept of the unique line through two points.

 

 

 

 

Slope m
y-intercept

About this calculator

Use this calculator to find the slope m and the y-intercept b of the line that passes through two points (x₁, y₁) and (x₂, y₂). The equation of the line is then y = m x + b.

The slope is m = (y₂ − y₁) / (x₂ − x₁), the rise over the run. The intercept is b = y₁ − m x₁. If x₁ equals x₂ the line is vertical, slope is undefined, and the calculator reports an error. Two lines are parallel if they share the same slope, and perpendicular if the product of their slopes is −1.

Use the same coordinate units for all four values. Slope is a dimensionless ratio (or a rise/run in those units); the intercept is on the same scale as y.

x₁: x-coordinate of the first point.

y₁: y-coordinate of the first point.

x₂: x-coordinate of the second point (must differ from x₁).

y₂: y-coordinate of the second point.

Slope m: Rise over run, (y₂ − y₁) / (x₂ − x₁).

y-intercept: Value of y where the line crosses the y-axis.