Gradient Calculator

Gradient Calculator

Find slope, angle, and line equation from two points.

Last updated: June 2026 | By Patchworkr Team

Line Parameters

Point 1 x is required.

Gradient is rise divided by run. When run is zero, the line is vertical and the slope is undefined.
Results
Enter two points to calculate the gradient.

What is Gradient?

Gradient is the same idea as slope in coordinate geometry. It measures how much y changes for each unit of x.

The formula is m = (y2 - y1) / (x2 - x1). If x2 - x1 = 0, the line is vertical and the slope is undefined.

Formula

Rise
rise = y2 - y1
Run
run = x2 - x1
Slope
m = rise / run

Example

For points (2, 3) and (5, 9), rise = 6 and run = 3.

m = 6 / 3 = 2
b = 3 - 2(2) = -1
y = 2x - 1
angle = arctan(2) ≈ 63.43°

FAQ

What if the two x-values are equal?

The line is vertical and the slope is undefined.

Can gradient be negative?

Yes. A negative gradient means the line falls from left to right.

Does the angle match the slope?

Yes. The angle is arctan(slope) measured in degrees.

Can blank input be used?

No. Blank input is treated as missing so accidental zero values do not slip through.

Related Tools