Convert units
Every product catalog, shipping form and scientific dataset eventually has to speak more than one system of measurement. The unit conversion API takes a value, a source unit and a target unit, and hands back a precise numeric result in JSON — no lookup tables to maintain, no rounding surprises baked into your own code.
Run — free
Runs in your browser. Free, unlimited — your data never leaves this page.
Why this exists
Teams shipping to both metric and imperial markets end up writing the same conversion helper three or four times across different services, and it inevitably drifts: one function rounds centimeters differently than another, temperature offsets get typo'd, and nobody remembers which service is right. This endpoint centralizes that logic once, so a checkout page, a warehouse system and a mobile app can all call the same source of truth instead of trusting their own copy-pasted math.
What you send and get back
POST a value, a from-unit and a to-unit — say, kilograms to pounds, liters to gallons, Celsius to Fahrenheit, square meters to acres, or gigabytes to gibibytes — and the task runs asynchronously. You get a task_id immediately, and the converted value arrives moments later through a signed webhook or a signed link valid for 24 hours, whichever fits your pipeline better.
The categories under the hood
Length, weight/mass, volume, temperature, area and digital storage are covered, each with the units people actually use in commerce and engineering: meters and feet, kilograms and ounces, liters and fluid ounces, Celsius/Fahrenheit/Kelvin, square feet and hectares, and the perennial confusion of decimal versus binary data units (megabytes versus mebibytes). Temperature conversions handle their non-linear offsets correctly instead of being treated as a simple multiplier, which is where hand-rolled conversion code most often breaks.
Fitting it into automation
Because the endpoint is stateless and async by design, it drops cleanly into batch jobs — normalize a supplier's spreadsheet of mixed units before importing it, localize product specs for a storefront, or standardize IoT sensor readings coming in from devices calibrated in different regions. Each call is billed only on success, so a malformed request or an unsupported unit pair never costs you anything.
Precision as a habit, not an afterthought
Unit conversion looks trivial until a mislabeled ounce (fluid vs. weight) or a truncated decimal costs someone real money or a failed shipment. Treating it as a dedicated, tested service rather than an inline snippet is a small decision that quietly prevents a whole class of bugs.
What you can do with it
E-commerce catalogs
Display product weight and dimensions in both metric and imperial automatically based on the shopper's region, without maintaining two parallel data fields.
Import/export logistics
Normalize supplier data sheets that mix kilograms, pounds and stones into a single consistent unit before it hits your warehouse system.
Scientific and engineering tools
Convert lab measurements or sensor readings between metric and imperial for reports that need to satisfy both US and international readers.
Recipe and nutrition apps
Switch between milliliters, cups and fluid ounces on demand so a single recipe database serves cooks anywhere.
FAQ
What unit categories does the unit conversion API support?
Length, weight/mass, volume, temperature, area and digital data (bytes, kilobytes, mebibytes, gigabytes and related units).
Is there a free tier for this API?
The tool above runs free in your browser. The API is paid — each call draws from your prepaid ForHosting KIT balance: top up from $10.00 (it never expires), pay each request's published price, and a call with no balance returns HTTP 402. No subscription, no tokens, and a failed task is never charged.
How much does each conversion cost?
$0.002 per request, billed only when the task succeeds — a failed or invalid request is never charged.
Does it handle temperature correctly, including the offset?
Yes. Celsius, Fahrenheit and Kelvin conversions apply the correct offset math, not a simple multiplier, avoiding the classic scaling bug.
How do I get the result — polling or webhook?
The call is asynchronous: you receive a task_id right away, and the result is delivered via a signed webhook (recommended) or a signed link valid for 24 hours.
Can I convert data storage units like GB to GiB?
Yes, the digital data category distinguishes decimal (SI) units like gigabytes from binary units like gibibytes, which are commonly confused.
Is this suitable for bulk conversion jobs?
Yes. Because each request is independent and async, it's well suited to batch pipelines converting large spreadsheets or datasets one call at a time.
What happens if I send an unsupported unit pair?
The task fails with a clear error after up to three retries, and — per policy — a failed task is never charged.
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, and soon from our app, email and Telegram.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/data/convert-units \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"items":["valor-1","valor-2"]}'const res = await fetch("https://api.kit.forhosting.com/data/convert-units", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"items": [
"valor-1",
"valor-2"
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/data/convert-units",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"items": [
"valor-1",
"valor-2"
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/data/convert-units", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"items":["valor-1","valor-2"]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"items":["valor-1","valor-2"]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/data/convert-units", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"items": [
"valor-1",
"valor-2"
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "data.convert_units",
"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_mb | 25 |
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. |