Gradient Calculator
Find the gradient (slope) of a line instantly from two points or a linear equation. Calculate the angle, y-intercept, and full equation of the line with step-by-step breakdowns.
Gradient & Slope Calculator
Calculate the gradient from points or an equation
Enter the coordinates of two distinct points on the line.
Your Gradient Results
Slope, angle, and line equation
Enter two points or a linear equation, then click Calculate to find the gradient, angle, and equation of the line.
Gradient & Angle Reference
Common gradient values and their corresponding angles with the positive x-axis.
| Gradient (m) | Angle (θ) | Line Type |
|---|---|---|
| 0 | 0° | Horizontal |
| 1 | 45° | Diagonal (Up) |
| √3 ≈ 1.732 | 60° | Steep (Up) |
| Undefined | 90° | Vertical |
| -1 | 135° (or -45°) | Diagonal (Down) |
| -√3 ≈ -1.732 | 120° (or -60°) | Steep (Down) |
Gradient Calculator FAQ
Everything you need to know about calculating gradients, slopes, and linear equations.
In mathematics, the gradient (also known as the slope) of a line measures its steepness and direction. It is defined as the ratio of the vertical change (rise) to the horizontal change (run) between any two points on the line. A positive gradient means the line goes uphill from left to right, while a negative gradient means it goes downhill.
To calculate the gradient from two points (x1, y1) and (x2, y2), you use the formula: m = (y2 – y1) / (x2 – x1). First, find the difference in the y-coordinates (the rise), then divide it by the difference in the x-coordinates (the run). This calculator performs this calculation automatically.
If your linear equation is in the slope-intercept form (y = mx + c), the gradient is simply the coefficient of x (the value of m). If the equation is in the general form (Ax + By = C), you can rearrange it to y = (-A/B)x + C/B, meaning the gradient is -A divided by B.
A positive gradient indicates that as the x-values increase, the y-values also increase; the line slopes upwards from left to right. A negative gradient indicates that as x-values increase, y-values decrease; the line slopes downwards from left to right.
The gradient (m) of a line is equal to the tangent of the angle (θ) it makes with the positive x-axis. The relationship is expressed as m = tan(θ). Conversely, you can find the angle using the inverse tangent function: θ = arctan(m). An angle of 0° means a gradient of 0 (horizontal), and 90° means an undefined gradient (vertical).
A gradient is undefined when the line is perfectly vertical. In the formula m = (y2 – y1) / (x2 – x1), a vertical line has the same x-coordinate for all points, meaning the denominator (x2 – x1) is zero. Since division by zero is mathematically undefined, vertical lines do not have a gradient.
Once you have the gradient (m), you can write the equation of the line using the point-slope form: y – y1 = m(x – x1), where (x1, y1) is any point on the line. By rearranging this, you get the slope-intercept form: y = mx + c, where c is the y-intercept (the point where the line crosses the y-axis).
Yes, a gradient of zero means the line is perfectly horizontal. In this case, there is no vertical change (rise = 0) as you move along the line, so m = 0 / run = 0. The equation for a horizontal line is simply y = c, where c is a constant.
