Math July 13, 2026 · 8 Min Read

Gradient Calculator – Guide & Formulas

Calculate the gradient (slope) of a line, curve, or surface. Free online calculator for rise over run, partial derivatives, and directional derivatives with step-by-step solutions.

Calculate the gradient (slope) of a line, curve, or surface with our free online calculator. Enter two points for line slope, or function details for partial derivatives and directional gradients.

Key Takeaway

Use the free Gradient Calculator to calculate the gradient (slope) of a line, curve, or surface. free online calculator for rise over run, partial derivatives, and directional derivatives with step-by-step solutions. Get instant results with step-by-step explanations.

How to Use the Gradient Calculator

  1. Select mode: Line Slope, Partial Derivative, or Directional Derivative.
  2. For Line Slope: enter two points (x₁, y₁) and (x₂, y₂).
  3. For Partial Derivative: enter the function and variable.
  4. Click Calculate to see the gradient value, angle, and step-by-step solution.

The Formula

Gradient (slope) = Rise / Run = (y₂ − y₁) / (x₂ − x₁). For surfaces: ∇f = (∂f/∂x, ∂f/∂y, ∂f/∂z).

Variable Definitions

  • ∇f: The gradient vector of function f (points in direction of steepest ascent)
  • ∂f/∂x: Partial derivative of f with respect to x
  • Δy / Δx: Change in y divided by change in x (rise over run)
  • θ: Angle of inclination: θ = arctan(gradient)

Gradient Between Points (2, 3) and (8, 15)

Calculate the slope of the line passing through two points.

  1. Step 1: Identify points: (x₁, y₁) = (2, 3), (x₂, y₂) = (8, 15).
  2. Step 2: Calculate rise: Δy = 15 − 3 = 12.
  3. Step 3: Calculate run: Δx = 8 − 2 = 6.
  4. Step 4: Gradient = 12 / 6 = 2.
  5. Step 5: Angle = arctan(2) = 63.43°. Percentage grade = 200%.

Frequently Asked Questions

What is a gradient?

A gradient is a measure of how steep a line, curve, or surface is. For a line, it is the ratio of vertical change to horizontal change (rise/run). For a surface, it is a vector of partial derivatives pointing in the direction of steepest ascent.

What does a positive gradient mean?

A positive gradient means the line slopes upward from left to right — as x increases, y also increases. The steeper the positive gradient, the faster the rise.

What does a negative gradient mean?

A negative gradient means the line slopes downward from left to right — as x increases, y decreases. A gradient of −1 means the line drops at a 45° angle.

What is a zero gradient?

A zero gradient means the line is perfectly horizontal — there is no vertical change. The line is flat, and the angle of inclination is 0°.

What is an undefined gradient?

An undefined gradient occurs for a vertical line where the horizontal change (run) is zero. Division by zero is undefined, and the angle of inclination is 90°.

How is gradient different from slope?

In most contexts, gradient and slope are synonymous for lines. However, gradient is more general — it extends to curves (instantaneous rate of change) and surfaces (vector of partial derivatives).

What is the gradient of a horizontal line?

The gradient of a horizontal line is 0. There is no vertical change regardless of horizontal movement.

What is percentage grade?

Percentage grade = gradient × 100%. A gradient of 0.08 equals an 8% grade, commonly used for roads and ramps.

What is the gradient vector for a surface?

For a surface z = f(x,y), the gradient vector is (∂f/∂x, ∂f/∂y). It points in the direction of steepest increase and its magnitude is the maximum rate of change.

How does gradient relate to calculus?

In calculus, the gradient generalizes the derivative to multiple dimensions. For a line, gradient = dy/dx. For a surface, the gradient is the vector of all partial derivatives.