Gradient Calculator — Slope, Grade & the Gradient Vector ∇f with Steps

Line gradient from two points (m = Δy/Δx, %, degrees, 1-in-X) or the ∇f gradient of a multivariable function evaluated at a point, shown symbolically.

Quick answer: Two tools in one: the gradient (slope) of a line through two points with rise/run, percent and angle — and the gradient vector ∇f of a function of x, y (and z) at a point, with symbolic partial derivatives.

How to use

  1. Line mode: enter two points (x₁, y₁) and (x₂, y₂) → read m = Δy/Δx, percent grade, angle, 1-in-X ratio, distance and the line equation.
  2. Function mode: type f(x, y) or f(x, y, z) — powers with ^, sin cos tan exp ln sqrt and so on are supported.
  3. Enter the point coordinates.
  4. Optionally enter a direction vector (u₁, u₂[, u₃]) for the directional derivative.
  5. Press Calculate: each symbolic partial derivative is printed, evaluated at the point, then combined into ∇f, |∇f| and Dᵤf.

About this tool

'Gradient' means two different things, and both live here. On a graph or a road it is the slope: gradient m = (y₂ − y₁)/(x₂ − x₁) — the rise over run between two points — which this mode converts into the percent grade road signs use, the angle in degrees, and the 1-in-X ratio surveyors quote, plus the line equation y = mx + b. In multivariable calculus the gradient is the vector of partial derivatives, ∇f = (∂f/∂x, ∂f/∂y, ∂f/∂z): it points in the direction of steepest increase of f, and its magnitude is that steepest rate. The second mode differentiates your expression symbolically — product rule, quotient rule and chain rule included — shows each partial derivative as an algebraic formula, then plugs in the point to evaluate the vector, its magnitude, and the directional derivative along any direction you type. Both modes show their working, so a slope of (8−3)/(2−1) = 5 and a ∇f computed from f = x²y + sin(xy) are both checkable line by line. Working with a different meaning of gradient (CSS colours)? Use the CSS Gradient Generator. For line work, the Aspect Ratio Calculator uses the same two-point math.

FAQ

How is the gradient of a line calculated?
m = (y₂ − y₁)/(x₂ − x₁) — the change in y divided by the change in x. Points (1, 3) and (2, 8) give m = 5/1 = 5. Positive slopes rise left-to-right, negative fall, and m = 0 is horizontal.
How do I convert slope to percent grade and degrees?
Percent grade is m × 100 (a 0.06 slope is a 6% road, the steepest allowed on many US interstates). The angle is arctan(m): 6% ≈ 3.43°. The '1 in X' form used in surveying is 1/m: a 1-in-12 ramp has m = 1/12 ≈ 0.083.
What does the gradient vector ∇f mean?
∇f = (∂f/∂x, ∂f/∂y, …) collects the rate of change of f in each axis direction. Its direction is where f increases fastest, its magnitude |∇f| is that fastest rate, and it is perpendicular to the level curves f = constant. Example: f = x²y at (2, 3) gives ∇f = (2·2·3, 2²) = (12, 4), |∇f| = √160 ≈ 12.65.
How is the directional derivative computed?
Dᵤf = ∇f · û, the dot product of the gradient with the unit vector in your direction. It is the rate of change of f as you move that way. Along the gradient direction it equals |∇f| (the maximum), and along a level curve it is 0 — the calculator normalizes your vector and shows the dot product step.
Why is the gradient of f = x² y + sin(xy) shown before numbers?
Because checking the symbolic derivative is the part students must learn: ∂/∂x gives 2xy + y·cos(xy) by the product and chain rules, and ∂/∂y gives x² + x·cos(xy). The tool prints these formulas, then substitutes the point — so you can compare your hand work against it, not just copy a decimal.
What happens on a vertical line or where ∇f = 0?
A vertical line has x₂ = x₁, so Δx = 0 and the slope is undefined — the mode reports it instead of returning ∞. A point where ∇f = (0, 0) is a critical point (peak, valley or saddle); the tool flags it, and a second-derivative check decides which.

Rate this tool

Your rating stays in this browser (local storage) — nothing is sent to any server.

Related tools

🎂

Age Calculator

Calculators

%

Percentage Calculator

Calculators

🏦

EMI / Loan Calculator

Calculators

⚖️

BMI Calculator

Calculators

🎓

CGPA / Percentage Converter

Calculators

📏

Land Area Converter

Calculators

📆

Date Difference Calculator

Calculators

🧁

Cooking Unit Converter

Calculators

🏷️

Unit Price Comparator

Calculators

🐕

Pet Cost Calculator

Calculators

⛽

Fuel Cost Calculator

Calculators

🎓

Grade Calculator

Calculators

📝

Final Exam Grade Calculator

Calculators

📅

Business Days Calculator

Calculators

🔢

Number to Words Converter

Calculators

🧮

Online Calculator

Calculators

📏

Length Converter

Calculators

⚖️

Weight Converter

Calculators

🌡️

Temperature Converter

Calculators

🏎️

Speed Converter

Calculators

🗺️

Area Converter

Calculators

🧪

Volume Converter

Calculators

🎈

Pressure Converter

Calculators

🍳

Cooking Measurement Converter

Calculators

👟

Shoe Size Converter

Calculators

🎲

Random Number Generator

Calculators

🎲

Online Dice Roller

Calculators

🪙

Coin Flip Online

Calculators

🤷

Yes or No Picker

Calculators

⏲️

Online Countdown Timer

Calculators

⏱️

Online Stopwatch

Calculators

🔢

Lucky Number Calculator

Calculators

♈

Zodiac Sign Finder (Star Sign)

Calculators

📈

Biorhythm Calculator

Calculators

🎨

Lucky Color Finder (By Birth Date)

Calculators

🐾

Pet Age Converter (Dog & Cat Years)

Calculators

🥣

Pet Food Calculator (Daily Portions)

Calculators

🎯

GPA Goal Calculator

Calculators

💱

Currency Converter

Calculators

🏛️

Roman Numeral Converter

Calculators

🍅

Pomodoro Timer

Calculators

📐

Aspect Ratio Calculator

Calculators

👥

Age Difference Calculator

Calculators

🌐

Bandwidth Calculator

Calculators

💰

1099 Tax Calculator

Calculators

💰

Annuity Calculator

Calculators

💰

ATS Resume Checker

Calculators

💰

Business Loan Calculator

Calculators

💰

Company Tax Calculator

Calculators

💰

Crypto Tax Calculator

Calculators

💰

CV Maker (Academic Style)

Calculators

💰

Debt Consolidation Loan Calculator

Calculators

💰

Employer Cost Calculator

Calculators

💰

Forex Lot Size Calculator

Calculators

💰

Forex Trade Simulator

Calculators

💰

Freelance Invoice Template

Calculators

💰

Life Insurance Needs Calculator

Calculators

💰

Australia Mortgage Calculator

Calculators

💰

Canada Mortgage Calculator

Calculators

💰

Florida Mortgage Calculator

Calculators

💰

Hawaii Mortgage Calculator

Calculators

💰

Maryland Mortgage Calculator

Calculators

💰

Texas Mortgage Calculator

Calculators

💰

UK Mortgage Calculator

Calculators

💰

Washington Mortgage Calculator

Calculators

💰

Online Will Maker

Calculators

💰

Overtime Calculator

Calculators

💰

Payroll Calculator

Calculators

💰

Georgia Employer Payroll Tax Calculator

Calculators

💰

New York Employer Payroll Tax Calculator

Calculators

💰

North Carolina Employer Payroll Tax Calculator

Calculators

💰

Texas Employer Payroll Tax Calculator

Calculators

💰

Quarterly Tax Calculator

Calculators

💰

Refinance Calculator

Calculators

💰

Resume Score Checker

Calculators

💰

Resume Template (Plain Text)

Calculators

💰

Retirement Investment Calculator

Calculators

💰

Retirement Savings Calculator

Calculators

💰

Reverse Mortgage Calculator

Calculators

💰

Salary Paycheck Calculator

Calculators

💰

Contractor Salary Calculator

Calculators

💰

Self-Employed Tax Calculator California

Calculators

💰

Self-Employed Tax Calculator UK

Calculators

💰

Solar Panel Cost Calculator

Calculators

💰

Stock Market Simulator

Calculators

💰

Federal Tax Calculator

Calculators

💰

Tax Deduction Calculator

Calculators

🧮

Scientific Calculator

Calculators

🎓

A-Level Grade Calculator

Calculators

📝

ACT Score Calculator

Calculators

🏫

SAT Score Calculator

Calculators

🍕

Fraction Calculator

Calculators

📐

Quadratic Equation Solver

Calculators

🐕

Dog Age Calculator

Calculators

⛳

Golf Handicap Calculator

Calculators

🏷️

Stacked Discount Calculator

Calculators

🔢

Mixed Number Calculator

Calculators

✖️

FOIL Calculator

Calculators

🔺

Discriminant Calculator

Calculators

🧮

Gaussian Elimination Calculator

Calculators

〰️

Fourier Series Calculator

Calculators

📐

Diagonal Calculator

Calculators

Related Tools & Guides

Audio Fade Audio Joiner Audio Merger Audio Normalizer Audio Speed Changer Audio Speed Pitch Changer