Quantity converter
5 feet is 1.524 meters, and asking to turn kilograms into meters gets a refusal instead of a made-up number. Convert within length, mass, volume, time and temperature, from millimeters to miles and milligrams to tonnes. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Value
- 5
- From
- Ft
- To
- M
- Result
- 1.524 m
- Kind
- length
- Si value
- 1.524
- Si unit
- m
A quantity converter takes a finite number and two unit names, then returns the same physical quantity expressed in the target unit — but only when both units measure the same kind of thing. Length stays length, mass stays mass, volume stays volume, time stays time, and temperature stays temperature. Students, warehouse clerks, lab technicians, and automation scripts all type the same three fields: the value they have, the unit it is in, and the unit they need.
What a measurement kind is and why mixed pairs fail
A physical quantity is a number times a unit, but the unit is not a free label — it belongs to a measurement kind. Length, mass, volume, time, and temperature are five different kinds. You can rescale five feet into meters because both names measure length.
You cannot rescale five kilograms into meters because mass and length are not the same quantity, no matter which prefixes you glue on. This quantity converter encodes that rule as a first-class contract. Every supported token is tagged with exactly one kind and an exact factor to a single SI base: meter for length, kilogram for mass, cubic meter for volume, second for time, and kelvin for temperature.
Conversion inside a kind is therefore a deterministic multiply-divide, except for temperature, which is affine: Celsius and Fahrenheit do not share a common zero, so the engine maps through kelvin with the published offsets 273.15 and 459.67 rather than pretending a single scale factor exists. Conversion across kinds is not a unit conversion at all.
What you enter, how temperature works, what you get
Both are restricted to a closed enum so the web form is a select, not a free-text trap. Length tokens are mm, cm, m, km, in, ft, yd, and mi. Mass tokens are mg, g, kg, t for the metric tonne, oz, and lb for the international avoirdupois pound.
Volume tokens are ml, l, m3, gal for the US liquid gallon, and qt for the US liquid quart. Time tokens are s, min, h, and d. Temperature tokens are c, f, and k.
Unknown tokens fail. On success the body echoes value, from, and to in canonical form, returns result as the converted magnitude rounded to twelve decimal places for stable goldens, returns unit as the target token so clients can display the number with its unit, and names the kind. For linear kinds, factor is the exact multiplier from the source unit to the target unit via the SI base.
Temperatures that would fall below absolute zero are rejected. Negative values are allowed on linear kinds because signed deltas appear in inventory and lab work; zero is allowed; only non-finite magnitudes are rejected.
Where a quantity converter earns its keep
Classrooms use a quantity converter so learners can drill mixed SI and US customary worksheets without flipping a factor by hand. A teacher can ask for five feet in meters and expect 1.524, or one hundred degrees Celsius in Fahrenheit and expect 212, and an LMS plugin can mark the same items with this deterministic oracle — including the items that should be marked wrong because the student tried to convert kilograms to meters. Failed validation does not consume balance.
Keep requests small, pin the rounded result in tests, and you get reproducible same-kind hops for homework, warehouse scripts, and edge workers without standing up a computer-algebra library of your own. Dedicated single-kind converters remain the right landing when the search is only length, only mass, or only temperature; this page is the generic quantity converter that insists the two units be compatible before it will return a number.
What you can do with it
Mixed-unit homework and LMS grading
Let students convert 5 ft to m or 100 °C to °F and fail closed when they try kilograms to meters, with a deterministic oracle for auto-grading.
Lab notebooks that mix SI and US customary
Convert milligrams to ounces and milliliters to US quarts when a protocol quotes mass and volume in two systems on the same page.
Shipping quotes and scheduler scripts
Turn kilograms into pounds, cubic meters into US gallons, and hours into seconds in freight or job queues without a general unit library.
FAQ
How do I convert a quantity between two units?
Send a finite number in value plus from and to from the closed unit list.
Which measurement kinds can I convert?
Length (mm, cm, m, km, in, ft, yd, mi), mass (mg, g, kg, t, oz, lb), volume (ml, l, m3, gal, qt), time (s, min, h, d), and temperature (c, f, k). gal and qt are US liquid.
Why is temperature not a simple multiply?
Celsius and Fahrenheit do not share a zero. The converter maps both through kelvin with the published offsets, then emits the target scale. Values below absolute zero are rejected.
What happens if I mix units of different kinds?
The converter refuses. Kilograms cannot become meters because mass and length are different quantities, so you get a clear message instead of an invented number. Pick two units of the same kind and try again.
Which gallon, quart and pound does it use?
The US liquid gallon and the US liquid quart for volume, and the international avoirdupois pound for mass. The ton option is the metric tonne, so check your source if it means a different ton.
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/quantity-converter \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"value":5,"from":"ft","to":"m"}'const res = await fetch("https://api.kit.forhosting.com/conv/quantity-converter", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"value": 5,
"from": "ft",
"to": "m"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/conv/quantity-converter",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"value": 5,
"from": "ft",
"to": "m"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/conv/quantity-converter", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"value":5,"from":"ft","to":"m"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"value":5,"from":"ft","to":"m"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/conv/quantity-converter", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"value": 5,
"from": "ft",
"to": "m"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "conv.quantity_converter",
"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
If you ask it to turn kilograms into meters it refuses with invalid_input instead of inventing a number. This endpoint multiplies linear kinds through an SI base — meter, kilogram, cubic meter, or second — and maps temperature through kelvin with the correct affine offset.
What a measurement kind is and why mixed pairs fail
Factors never come from the network or from wall-clock time; they are the published SI and US customary definitions baked into a tiny lookup table so the same request always yields the same JSON.
Input contract, temperature, and the response shape
POST a JSON body with three required fields. value is the numeric quantity to convert and must be a finite number; JSON numbers and numeric strings are accepted, but NaN, Infinity, empty strings, and missing values fail with invalid_input naming the field. from is the source unit and to is the target unit. A pair whose kinds differ — for example from kg to m — is an incompatible measurement kind and also fails with invalid_input; that error is not billed. Temperature responses omit factor because an affine map is not a single multiplier; they still return si_value in kelvin.
Where a quantity converter earns its keep
Laboratories convert milligrams to ounces and milliliters to US quarts when a protocol mixes systems; shipping desks convert kilograms to pounds and cubic meters to gallons when quoting freight; schedulers convert hours to seconds when a downstream API only speaks SI time.
Technical questions
What happens if the two units are different kinds?
The task fails with invalid_input naming the incompatible measurement kinds — for example kilograms (mass) to meters (length). Mixed-kind requests are not billed.
What does the quantity converter cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.