Slope Calculator

Free slope calculator. Find the slope, y-intercept, angle, and length of the line through two points, with the line equation and vertical-line handling.

AI-ready Use this tool with AI

This tool has a free JSON API. Copy a prompt or skill below to use it with ChatGPT, Claude, or any AI agent — no API key needed.

API docs
Enter two points above.

How slope calculator works

The slope of a line measures how steep it is — the change in y for each unit of x. Given two points (x1, y1) and (x2, y2), the slope is (y2 − y1) / (x2 − x1). A positive slope rises to the right, a negative slope falls, a zero slope is horizontal, and a vertical line has an undefined slope.

This calculator takes two points and returns the slope, the angle the line makes with the x-axis (in degrees), the y-intercept (where the line crosses y = 0), and the straight-line distance between the points. It also writes the line equation y = mx + b, and reports a vertical line as undefined with angle 90 degrees.

Enter the coordinates of the two points and the tool returns the slope, intercept, angle, length, and equation. Use it for algebra homework, graphing lines, and any task involving the gradient between two points.

Frequently asked questions

How is the slope calculated?
As (y2 − y1) / (x2 − x1), the rise over the run between the two points. For (1,1) and (3,7) that is (7-1)/(3-1) = 3.
What happens for a vertical line?
When x1 equals x2 the denominator is zero, so the slope is undefined. The calculator reports the line as vertical with an angle of 90 degrees rather than dividing by zero.
What is the y-intercept?
The y value where the line crosses the y-axis (x = 0). Once you have the slope m, the intercept b is y1 − m·x1, giving the line equation y = mx + b.
How is the angle found?
As the arctangent of the slope, converted from radians to degrees. A slope of 3 gives an angle of about 71.6 degrees above the horizontal.