Use this gradient calculator tool to easily generate a custom color gradient code for your website or project.
Gradient Calculator
How to Use the Gradient Calculator
The Gradient Calculator helps you find the gradient (or slope) of a line by providing the coordinates of two points on that line. To use the calculator, follow these steps:
- Enter the X-coordinate for Point 1 in the first input field.
- Enter the Y-coordinate for Point 1 in the second input field.
- Enter the X-coordinate for Point 2 in the third input field.
- Enter the Y-coordinate for Point 2 in the fourth input field.
- Click on the “Calculate” button to get the result.
How It Calculates the Results
The calculator uses the formula:
m = (Y2 - Y1) / (X2 - X1)
where m is the gradient, (X1, Y1) are the coordinates of the first point, and (X2, Y2) are the coordinates of the second point.
Limitations
The Gradient Calculator assumes that:
- Point 1 and Point 2 are not the same point.
- The line is not vertical; for a vertical line (where X1 = X2), the gradient is undefined, and the calculator will display “Undefined (Vertical Line)”.
- The input coordinates are numbers.