KG to gallons converter
10 kg of a liquid at 2 kg per gallon is 5 gallons: divide a weighed mass by the density from your certificate or data sheet and get the volume in that same US or imperial gallon, with no hidden water assumption. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Kg
- 10
- Density
- 2
- Result
- 5 gal
- Converted
- 5
- Density unit
- kg/gal
- Gallons
- 5
A kilograms-to-gallons converter turns a weighed mass of liquid into a volume in gallons once you know how many kilograms occupy one gallon of that liquid. Water is a common sanity check: about three point seven eight five kilograms per US gallon yields one gallon for that many kilograms.
Why kilograms of liquid are not gallons until density is known
Kilograms measure mass. Gallons measure volume. A kilogram of honey and a kilogram of gasoline do not occupy the same space, so a kilograms-to-gallons landing that hid a single default density would silently lie on every liquid except the one it assumed.
The identity is volume equals mass divided by density when density is expressed as mass per unit volume. Callers must supply density because density is a liquid property, not a unit factor between SI mass and a volume unit. Typical figures people already have from a data sheet include about three point seven eight five kilograms per US gallon for fresh water near four degrees Celsius, a slightly higher value for whole milk, and a lower value for gasoline or diesel.
Those figures are examples only; this capability never looks up a material table and never guesses. If you only have density in kilograms per litre, multiply by the gallon volume in litres — about three point seven eight five four litres per US gallon, or about four point five four six litres per imperial gallon — to obtain kilograms per gallon before calling. If you only have specific gravity relative to water, multiply that gravity by the kilograms-per-gallon figure for water in the gallon system you intend.
Zero kilograms maps to zero gallons at any valid density. The conversion is linear in mass and inverse in density, so doubling the mass doubles the gallons and doubling the density halves the gallons, which is the check estimators use when a tank fill looks off by a factor of two. Density of zero would divide by zero; negative density is not a physical liquid property for this identity and is rejected rather than silently inverted.
Where kilograms-to-gallons conversion is used, and what this tool is not
Process and quality labs convert a weighed sample or a drum net weight into gallons before filling a vessel that is labelled in gallons, using a density from the certificate of analysis rather than a generic table. Food and beverage plants turn kilogram batch tickets for oil, syrup, or milk into gallons for tank inventory and for comparing a supplier quote that bills by the gallon.
Fuel desks convert a kilogram mass of gasoline, diesel, or jet fuel into gallons for a dispatch ticket when density at the measured temperature is already known. Students checking the identity volume equals mass over density use the same contract as a production pipeline, which is the point of a deterministic parse tool. Prefer this landing when the search is kg to gallons, kilograms to gallons, or convert kilograms of a liquid to gallons and you already have density in kilograms per gallon.
It is not a general volume-unit hub that turns litres into gallons without a mass, not a density solver that rearranges rho equals m over V from two other fields, and not a water-only shortcut that hides three point seven eight five as a default. Stay inside the absolute range so the quotient cannot overflow. Pair the result with your own temperature correction if the data sheet density was measured at a different temperature than the batch you weighed.
What you can do with it
Lab samples and process tanks
Turn a weighed liquid sample or a drum net weight into gallons using the density from the certificate of analysis, then fill a vessel labelled in gallons without guessing water.
Food, beverage, and oil batch tickets
Convert kilogram batch tickets for milk, syrup, or cooking oil into gallons for tank inventory and for comparing a supplier quote that bills by the gallon.
FAQ
What formula converts kilograms of a liquid to gallons?
Gallons = kilograms ÷ density, when density is in kilograms per gallon (kg/gal). The tool returns that quotient rounded to twelve decimal places, plus substitution steps.
What happens if density is zero or negative?
Volume = mass / density is undefined at zero density, and a negative liquid density is not a physical value for this identity. Failed tasks are not billed.
Are the results US gallons or imperial gallons?
The gallon in the result is the same gallon used in the density you send. Kilograms per US gallon yields US gallons; kilograms per imperial gallon yields imperial gallons. The tool does not convert between those systems.
Can I convert gallons back to kilograms?
This capability is kilograms → gallons only. Multiply gallons by density (kg/gal) on your side to recover mass, or use a density-from-mass-and-volume solver if you need to rearrange ρ = m / V.
Is the kg to gallons converter free?
The browser tool is free and runs locally.
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/conv/kg-to-gallons \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"kg":10,"density":2}'const res = await fetch("https://api.kit.forhosting.com/conv/kg-to-gallons", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"kg": 10,
"density": 2
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/conv/kg-to-gallons",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"kg": 10,
"density": 2
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/conv/kg-to-gallons", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"kg":10,"density":2}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"kg":10,"density":2}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/conv/kg-to-gallons", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"kg": 10,
"density": 2
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "conv.kg_to_gallons",
"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.
Limits
max_abs | 1000000000000 |
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
Density must be a positive finite number: zero or negative density is physically undefined for this identity and fails with invalid_input, which is not billed.
Why kilograms of liquid are not gallons until density is known
Here the volume unit is the gallon used in the density: gallons equals kilograms divided by kilograms per gallon. That is the whole algorithm: two finite numbers, one division, then stable rounding.
Input contract, gallon system, errors, and the response shape
The gallon in the result is the same gallon used in the density you send: kilograms per US gallon yields US gallons; kilograms per imperial gallon yields imperial gallons. A missing or negative mass fails the same way, naming kg. Send a JSON body with two required finite numbers: kg, the non-negative mass of the liquid in kilograms, and density, the strictly positive density in kilograms per gallon. Aliases kilograms, mass, weight, value, and kg_value are accepted for the mass field; rho, density_kg_gal, kg_per_gallon, and kg_gal are accepted for density, so SDK clients and form posts can use the name that fits the product. This endpoint does not convert between those systems and does not assume water. On success the response echoes rounded kg and density, sets density_unit to kg/gal, and sets gallons, result, and converted to the same rounded gallon magnitude. unit and to_unit are the token gal, from_unit is kg, formula restates gallons equals kg divided by density, message is a short English summary, and steps is an ordered array of substitution lines. The stated product error is density that is not a positive number: zero, negative, missing, empty, non-numeric, or non-finite density fails with invalid_input naming density and is never charged. Pricing is a flat $0.002 per successful request with unit item.
Where kilograms-to-gallons conversion is used, and what this tool is not
Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when a learner deliberately sends a zero density to see the error.
Integration use cases
Fuel dispatch and homework checks
Fuel desks convert a kilogram mass of gasoline or diesel to gallons at a known density; students pin golden JSON so browser and API arithmetic never drift.