Metric converter
2.5 km is 2500 m and 500 ml is 0.5 l. Choose the unit you have and the one you need among twelve metric units of length, mass and volume, and skip moving the decimal point by hand. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Value
- 2.5
- From
- Km
- To
- M
- Result
- 2,500 m
- Quantity
- length
- Factor
- 1,000
- Si value
- 2,500
A metric converter turns a finite number from one SI-family unit into another without mixing length, mass, and volume. Students, warehouse clerks, lab technicians, and shipping desks type the same three fields every day: the value, the unit they have, and the unit they need. Non-finite values are also rejected.
SI families, prefixes, and why mixed pairs fail
The International System of Units organizes everyday measurement into coherent families rather than a grab-bag of historical names. Length lives on the meter, mass on the kilogram, and volume on the cubic meter. Every common metric unit this converter accepts is an exact power-of-ten multiple of one of those three bases.
Millimeters, centimeters, meters, and kilometers differ only by SI prefixes: milli is one thousandth, centi is one hundredth, and kilo is one thousand. Milligrams, grams, kilograms, and tonnes follow the same prefix logic on mass, with the tonne defined as one thousand kilograms. Milliliters, liters, cubic centimeters, and cubic meters sit on volume; a milliliter is defined as one cubic centimeter, so converting milliliters to cubic centimeters is an identity.
Conversion inside a family is therefore a single multiply-divide: the input times the source factor over the target factor. Conversion across families is not a unit conversion at all. A kilogram is not a length, and a meter is not a volume.
What you enter and what you get back
Both are restricted to a closed enum of common metric tokens: mm, cm, m, and km for length; mg, g, kg, and t for mass; ml, l, cm3, and m3 for volume. 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 without another lookup, and names the quantity as length, mass, or volume. factor is the exact multiplier from the source unit to the target unit via the SI base. formula restates the arithmetic as a short string suitable for a receipt or a homework check.
Negative values are allowed because signed deltas appear in inventory and lab work; zero is allowed; only non-finite magnitudes are rejected.
Where a metric converter earns its keep
Classrooms use a metric converter so learners can drill SI prefixes without flipping a decimal point by hand. A teacher can ask for 2.5 kilometers in meters and expect 2500, or 500 milliliters in liters and expect 0.5, and an LMS plugin can mark the same items with this deterministic oracle. Laboratories convert milligrams to grams and milliliters to cubic meters when preparing reagents; shipping desks convert kilograms to tonnes and cubic meters to liters when quoting freight.
Failed validation does not consume balance. Keep requests small, pin the rounded result in tests, and you get reproducible SI hops for homework, warehouse scripts, and edge workers without standing up a general unit-conversion library of your own. Dedicated imperial converters remain the right tool when the search is miles, pounds, or gallons rather than SI prefixes.
What you can do with it
Classroom SI prefix drills
Let students convert 2.5 km to m or 500 ml to l and verify the exact power-of-ten result against textbook prefix tables.
Lab notebooks and reagent prep
Convert milligrams to grams and milliliters to cubic centimeters when a protocol mixes SI prefixes on mass and volume.
Shipping quotes and warehouse scripts
Turn kilograms into tonnes and cubic meters into liters in freight calculators without pulling a general unit library.
FAQ
Which metric units can I convert?
Length: mm, cm, m, km. Mass: mg, g, kg, t (tonne). Volume: ml, l, cm3, m3. The pair must share a quantity; milliliters and cubic centimeters are the same volume.
Can I convert kilograms to meters?
No. That pair is unsupported because mass and length are different SI families.
How are milliliters and cubic centimeters related?
Converting between them returns the same magnitude with the target unit token.
What happens if the value is Infinity or NaN?
Only finite numbers are accepted. Missing fields and unknown unit names fail the same way.
Can I convert a negative value?
Yes. Negative numbers are accepted because signed differences show up in inventory and lab work, and zero works too. Only values that are not finite numbers are refused.
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/metric-converter \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"value":2.5,"from":"km","to":"m"}'const res = await fetch("https://api.kit.forhosting.com/conv/metric-converter", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"value": 2.5,
"from": "km",
"to": "m"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/conv/metric-converter",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"value": 2.5,
"from": "km",
"to": "m"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/conv/metric-converter", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"value":2.5,"from":"km","to":"m"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"value":2.5,"from":"km","to":"m"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/conv/metric-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": 2.5,
"from": "km",
"to": "m"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "conv.metric_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
This endpoint accepts those three fields, multiplies through an exact SI base — meter, kilogram, or cubic meter — and returns the converted value with the target unit. Cross-family pairs such as kilograms to meters are rejected as invalid_input rather than inventing a meaningless number.
SI families, prefixes, and why mixed pairs fail
This capability refuses those pairs with invalid_input instead of inventing a number. Factors never come from the network or from wall-clock time; they are the published SI definitions baked into a tiny lookup table so the same request always yields the same JSON.
Input contract, response shape, and error behaviour
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 families differ — for example from kg to m — is an unsupported unit pair and also fails with invalid_input; that error is not billed.
Technical questions
What does the metric converter cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.