Hydraulic gradient calculator
Heads of 20 m and 16 m at two wells 100 m apart give a hydraulic gradient of 0.04, with groundwater moving from the first well toward the second. Enter both heads and the spacing in one length unit. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Head 1
- 20
- Head 2
- 16
- Distance
- 100
- Head difference
- 4
- Hydraulic gradient
- 0.04
- Current (A)
- 0.04
- Gradient magnitude
- 0.04
The hydraulic gradient is the slope of the water table or potentiometric surface: the change in hydraulic head between two observation points divided by the distance that separates them. Groundwater textbooks write it as i equals (h1 minus h2) over L, a dimensionless ratio when head and distance share the same length unit. Students checking Darcy-flow homework, hydrogeologists reducing piezometer pairs, and drainage designers sizing underdrains all need that same three-number contract and one reproducible result. This calculator accepts hydraulic head at two points and the path length between them, divides the head difference by that distance, and returns the signed dimensionless gradient together with its magnitude, the echoed inputs, and the textbook formula.
What i = (h1 − h2) / L means and which quantities you need to send
In groundwater hydrology and seepage analysis the hydraulic gradient is the slope of hydraulic head along a flow path: the difference in head between two observation points divided by the distance that separates them. Hydraulic head itself is the energy per unit weight of water, usually reported as an elevation plus a pressure head, so two piezometer readings already sit in length units.
When those heads and the connecting distance share the same unit—metres with metres, feet with feet—the ratio i equals (h1 minus h2) over L is dimensionless, which is why textbooks call it a gradient rather than a slope written out as metres per metre. Search intent clusters around phrases such as hydraulic gradient calculator, groundwater head slope, Darcy i from two piezometers, dimensionless hydraulic gradient, and change in head over distance.
Students checking a flow-net homework set, consultants reducing a pair of monitoring wells, and drainage designers sizing a gravel drain all want a numeric i they can pin against a worksheet or feed into Darcy's law as the driving term q equals minus K times i.
Sign is part of the contract: a positive i means head falls from point 1 toward point 2, so groundwater would move from 1 toward 2 in an isotropic medium; a negative i means the opposite; a zero i means a flat potentiometric surface between the two points.
What you can do with it
Homework and piezometer-pair checks
Students and graders confirm dimensionless i from two hydraulic heads and the well spacing, with clear rejection when distance is zero, negative, or a field is missing.
FAQ
What happens if the distance between the two points is zero?
Dividing a head difference by a zero path length is undefined, so a zero or negative distance is rejected and is not billed.
Why is the hydraulic gradient dimensionless?
Hydraulic head and the connecting distance are both lengths. When they share the same unit, (h1-h2)/L is a pure number—the slope of the potentiometric surface—ready to multiply by hydraulic conductivity in Darcy's law.
What does a negative hydraulic gradient mean?
It means head rises from point 1 to point 2, so groundwater would flow from point 2 toward point 1 in a uniform aquifer. A gradient of zero means a flat water table between the two points.
Can a hydraulic head be negative?
Yes. A head below your chosen datum is common, for example in a confined aquifer measured from ground surface, and it is accepted. Only the distance between the points must be positive.
How do I use the gradient in Darcy's law?
Multiply it by the hydraulic conductivity of the soil or rock, with a minus sign, to get the Darcy flux. You supply the conductivity yourself, because the calculator does not look it up.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/phys/hydraulic-gradient \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"head_1":20,"head_2":16,"distance":100}'const res = await fetch("https://api.kit.forhosting.com/phys/hydraulic-gradient", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"head_1": 20,
"head_2": 16,
"distance": 100
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/phys/hydraulic-gradient",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"head_1": 20,
"head_2": 16,
"distance": 100
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/phys/hydraulic-gradient", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"head_1":20,"head_2":16,"distance":100}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"head_1":20,"head_2":16,"distance":100}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/phys/hydraulic-gradient", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"head_1": 20,
"head_2": 16,
"distance": 100
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "phys.hydraulic_gradient",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
A zero or negative distance is rejected with invalid_input instead of a divide-by-zero.
What i = (h1 − h2) / L means and which quantities you need to send
Delivering head_1, head_2, distance, head_difference, hydraulic_gradient, the short alias i, gradient_magnitude, formula, method, and a small flow_from hint as JSON makes the result easy to paste into notes, diff in automated tests, or reuse across languages without reimplementing the subtraction and division. Keep the length basis honest: mixing a head in metres with a well spacing in kilometres without converting first will silently scale i by a thousand and is not a unit-conversion service this endpoint provides.
How this calculator validates input and applies i = (h1 − h2) / L
Numeric strings that parse to finite numbers are accepted so forms and CSV-style pipelines can pass values without an extra cast. Distance must be strictly positive. A negative distance is rejected for the same reason: L is a geometric path length, not a signed coordinate jump. Hydraulic heads may be any finite value, including readings below a chosen datum; a negative head is physically common in confined aquifers referenced to ground surface and is not treated as an error. There is no unit-conversion table, no hydraulic-conductivity lookup, and no finite-difference groundwater solver; this is ideal one-dimensional i from three known quantities. Send a JSON body with three required fields: head_1, head_2, and distance. Every field must be finite: missing fields, empty strings, non-numeric text, NaN, and Infinity all fail immediately with invalid_input before any result is returned, and failed validation is not charged. Aliases are supported: h1, head1, hydraulic_head_1 for head_1; h2, head2, hydraulic_head_2 for head_2; L, length, dl for distance. A zero distance is always rejected as invalid_input because dividing a head difference by a vanishing path length is undefined, and that failure is the product contract named in the capability brief. After validation the engine subtracts head_2 from head_1, divides by distance, takes the absolute value for gradient_magnitude, and rounds to a stable decimal precision so the same input always yields the same JSON across JavaScript engines. A soft flow_from label records the implied isotropic direction—1_to_2 when i is positive, 2_to_1 when i is negative, and none when the heads are equal—purely as an educational convenience; it is not a three-dimensional flow-net, a particle-track, or a heterogeneous-aquifer classifier. The same pure function powers the free in-browser tool and the API path.
Practical use, limits, pricing, and delivery channels
Use the browser tool when you want an immediate i equals (h1 minus h2) over L check while grading a hydrogeology homework set, reducing a pair of site piezometers, sketching whether seepage under a sheet pile is steep enough to worry about piping, or sanity-checking the driving term you are about to multiply by hydraulic conductivity in Darcy's law. Choose units consistently—if both heads and the distance are in metres, i is dimensionless and ready for textbook comparison; the same is true for feet with feet. There is no language model, no external well-log service, and no randomness, so the capacity is safe to pin in continuous-integration checks and reproducible lesson materials. Each successful request is one billable item at $0.002; failed validation does not consume balance. Results are fully deterministic: the same three inputs always yield the same hydraulic_gradient, the same i alias, the same gradient_magnitude, and the same formula and method labels. Wire the endpoint into Darcy drills, contest answer checkers, seepage sketch tools, or preprocessing steps where you already prefer explicit domain errors—such as rejecting a zero distance—over opaque black-box widgets that cannot explain why a bad input was refused.
Integration use cases
Deterministic fixtures for Darcy pipelines
Scripts that later compute specific discharge q = −K i can call a pure i=(h1-h2)/L oracle instead of reimplementing the head-over-distance arithmetic in every language.
Quick seepage and drainage sketches
Engineers and educators get structured i plus a soft flow_from hint for underdrain, sheet-pile, and water-table sketches without standing up a full groundwater model.
Technical questions
How do I compute the hydraulic gradient from two heads and a distance?
Send finite numbers head_1, head_2, and a strictly positive distance. The API returns i=(h1-h2)/L as hydraulic_gradient (and alias i), plus gradient_magnitude, head_difference, and a soft flow_from hint.
Does a negative hydraulic gradient mean flow the other way?
Yes in the one-dimensional isotropic convention used here: i>0 implies head falls from point 1 toward point 2 (flow_from 1_to_2); i<0 implies the opposite; i=0 means a flat head between the two points.
What does the hydraulic gradient calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.