What is the Gradient (Slope) Calculator?
This tool finds the gradient — also called the slope — of a straight line that passes through two points. The gradient measures how steep the line is: how much it rises (or falls) vertically for each unit it moves horizontally. It is a universal math concept used in algebra, geometry, physics, engineering and construction.
How to use it
Enter the coordinates of two points on the line: the first point (X₁, Y₁) and the second point (X₂, Y₂). The calculator returns the slope m, the rise (Δy), the run (Δx), the slope expressed as a percentage grade, the angle of incline in degrees, and the y-intercept b of the line y = mx + b.
The formula explained
The slope is the ratio of vertical change to horizontal change:
$$m = \frac{y_2 - y_1}{x_2 - x_1}$$
A positive slope rises left-to-right, a negative slope falls. A slope of 0 is a horizontal line. When \(x_2 = x_1\) the run is zero and the line is vertical, so the slope is undefined (we report a 90° angle). The percent grade is simply \(m \times 100\), and the angle is \(\arctan(m)\).
Worked example
Take the points (1, 2) and (4, 8). The rise is \(\Delta y = 8 - 2 = 6\) and the run is \(\Delta x = 4 - 1 = 3\). So $$m = 6 \div 3 = 2.$$ That is a 200% grade and an angle of \(\arctan(2) \approx 63.43°\). The y-intercept is \(b = y_1 - m \cdot x_1 = 2 - 2 \cdot 1 = 0\), giving the line \(y = 2x\).
FAQ
What does a negative gradient mean? The line slopes downward as you move from left to right; y decreases as x increases.
Why is a vertical line's slope undefined? The run \((x_2 - x_1)\) is zero, and division by zero is undefined. We display the angle as 90°.
What is the difference between slope and percent grade? Percent grade is just the slope multiplied by 100 — a slope of 0.05 equals a 5% grade.