Gradient Calculator

Calculate line gradient, y-intercept, equation, and angle from two coordinate points.

Calculate the Gradient of a Line
Enter two distinct points on the line.
Point 1 Coordinates
Point 2 Coordinates

About Line Gradients

The gradient, also called slope, measures how quickly a straight line rises or falls as its horizontal coordinate changes. Given two points, subtract the first y-coordinate from the second to obtain the rise, then subtract the first x-coordinate from the second to obtain the run. Dividing rise by run gives the gradient. This calculator performs those steps and derives the line's y-intercept, slope-intercept equation, and inclination angle. A positive gradient means the line rises from left to right, while a negative gradient means it falls. A zero gradient describes a horizontal line. The larger the absolute value, the steeper the line. Because the result is a ratio of coordinate changes, slope has units of vertical units per horizontal unit. It is dimensionless when both axes use the same unit, but it can represent quantities such as dollars per hour or meters per second when axes measure different variables. The y-intercept is the y-value where the line crosses the vertical axis. Once the gradient is known, substitute either input point into the slope-intercept relationship and subtract gradient times x from y. The calculator formats the result as a familiar linear equation. A vertical line cannot be represented in slope-intercept form because its run is zero; its gradient is undefined and its equation instead fixes x at one constant value. The inclination angle is the inverse tangent of the gradient, reported in degrees between negative ninety and positive ninety. A positive angle turns counterclockwise above the positive x-axis, and a negative angle turns clockwise below it. Vertical lines are reported as ninety degrees. Depending on context, another coterminal angle may describe the same infinite line, but this principal angle clearly communicates its direction and steepness. Gradients are fundamental in coordinate geometry, algebra, graphing, physics, engineering, economics, and data analysis. They describe constant rates, linear trends, ramps, roof pitches, and changes between measured observations. Make sure both points use the same coordinate system and enter them in matching x and y pairs. Swapping the order of the two complete points does not change the gradient, but mixing coordinates from different points produces an incorrect line.

Gradient Examples

These point pairs demonstrate rising, falling, and vertical lines.

PointsGradient and equationLine type
(1, 2) and (3, 6)m = 2, y = 2xRising line
(0, 5) and (5, 0)m = -1, y = -x + 5Falling line
(2, 1) and (2, 8)Undefined, x = 2Vertical line

How to Calculate Gradient

  1. Enter the x-coordinate and y-coordinate of the first point.
  2. Enter the coordinates of a different second point.
  3. Select Calculate Gradient to divide the change in y by the change in x.
  4. Review the slope, intercept, line equation, and inclination angle.

Frequently Asked Questions

What is the gradient formula?

Subtract the first y-coordinate from the second and divide by the second x-coordinate minus the first. This is commonly described as rise over run.

What does a negative gradient mean?

A negative gradient means y decreases as x increases. On a standard graph, the line slopes downward from left to right.

Why is a vertical line's gradient undefined?

Both points on a vertical line have the same x-coordinate, so the run is zero. Division by zero is undefined, and the line is written with a constant x-value instead.

How is the y-intercept found?

Insert either point and the calculated gradient into the slope-intercept relationship. Rearranging gives the intercept as y minus gradient times x.

Can I use decimal or negative coordinates?

Yes, each coordinate can be positive, negative, zero, or decimal. The only invalid pair is two identical points because infinitely many lines pass through a single location.