Unit Conversion
Convert between units of measurement and discover available conversion types. Supports length, weight, volume, temperature, area, and speed conversions.
Overview
Use Cases
- Scientific and engineering calculations
- Travel and distance planning
- Recipe scaling and cooking conversions
- Fitness and health tracking
- Educational tools
- Build unit selection dropdowns in UIs
Features
Length, weight, volume, temperature, area, and speed conversions
39 supported units across 6 categories
Human-readable formula in every response
Results rounded to 6 decimal places
Fast, no-database lookups
Endpoint to discover all available units
API Endpoints
Convert Units
Convert a value from one unit to another
GET
https://api.requiems.xyz/v1/misc/convert
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| from | string |
Required | Source unit key (e.g. miles, kg, c) |
| to | string |
Required | Target unit key (e.g. km, lb, f) |
| value | number |
Required | Numeric value to convert |
Try it out
Live DemoRequest
Source unit key (e.g. miles, kg, c)
Target unit key (e.g. km, lb, f)
Numeric value to convert
Sending request...
Response Fields
| Field | Type | Description |
|---|---|---|
| from | string |
Source unit key |
| to | string |
Target unit key |
| input | number |
The original input value |
| result | number |
The converted value (rounded to 6 decimal places) |
| formula | string |
Human-readable conversion formula |
Code Examples
curl "https://api.requiems.xyz/v1/misc/convert?from=miles&to=km&value=10" \
-H "requiems-api-key: YOUR_API_KEY"
import requests
url = "https://api.requiems.xyz/v1/misc/convert"
params = {"from": "miles", "to": "km", "value": 10}
headers = {"requiems-api-key": "YOUR_API_KEY"}
response = requests.get(url, params=params, headers=headers)
print(response.json())
const params = new URLSearchParams({ from: 'miles', to: 'km', value: 10 });
const response = await fetch(`https://api.requiems.xyz/v1/misc/convert?${params}`, {
headers: {
'requiems-api-key': 'YOUR_API_KEY'
}
});
const { data } = await response.json();
console.log(data.result); // 16.09344
require 'net/http'
require 'json'
uri = URI('https://api.requiems.xyz/v1/misc/convert')
uri.query = URI.encode_www_form(from: 'miles', to: 'km', value: 10)
request = Net::HTTP::Get.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
data = JSON.parse(response.body)['data']
puts data['result'] # 16.09344
List Available Units
Returns all available unit conversion types grouped by measurement category
GET
https://api.requiems.xyz/v1/misc/convert/units
Try it out
Live DemoRequest
Sending request...
Response Fields
| Field | Type | Description |
|---|---|---|
| length | array |
Available length units: millimeter (mm), centimeter (cm), meter (m), kilometer (km), inch (in), foot (ft), yard (yd), mile (miles), nautical mile (nmi) |
| weight | array |
Available weight units: milligram (mg), gram (g), kilogram (kg), metric ton (t), ounce (oz), pound (lb), stone (stone) |
| volume | array |
Available volume units: milliliter (ml), liter (l), teaspoon (tsp), tablespoon (tbsp), fluid ounce (fl_oz), cup (cup), pint (pt), quart (qt), gallon (gal) |
| temperature | array |
Available temperature units: celsius (c), fahrenheit (f), kelvin (k) |
| area | array |
Available area units: square millimeter (mm2), square centimeter (cm2), square meter (m2), square kilometer (km2), square inch (in2), square foot (ft2), square yard (yd2), acre (acre), hectare (ha) |
| speed | array |
Available speed units: meters per second (m_s), kilometers per hour (km_h), miles per hour (mph), knots (knots) |
Code Examples
curl https://api.requiems.xyz/v1/misc/convert/units \
-H "requiems-api-key: YOUR_API_KEY"
import requests
url = "https://api.requiems.xyz/v1/misc/convert/units"
headers = {"requiems-api-key": "YOUR_API_KEY"}
response = requests.get(url, headers=headers)
units = response.json()['data']
# Print all length units
print("Length units:", units['length'])
const response = await fetch('https://api.requiems.xyz/v1/misc/convert/units', {
headers: {
'requiems-api-key': 'YOUR_API_KEY'
}
});
const { data } = await response.json();
// Build a dropdown with length units
data.length.forEach(unit => {
console.log(`<option value="${unit}">${unit}</option>`);
});
require 'net/http'
require 'json'
uri = URI('https://api.requiems.xyz/v1/misc/convert/units')
request = Net::HTTP::Get.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
units = JSON.parse(response.body)['data']
puts "Temperature units: #{units['temperature'].join(', ')}"
Frequently Asked Questions
Length, weight, volume, temperature, area, and speed. You cannot convert between different categories (e.g. miles to kg will return a 400 error).
Results are rounded to 6 decimal places. The formula field shows the exact conversion factor used.
Yes. Unit keys must be lowercase exactly as shown in the supported units table (e.g. use "km" not "KM").
No. Call the /v1/misc/convert/units endpoint once to discover available units, then cache the response. The list of available units changes very infrequently.
No. You can only convert between units within the same category. For example, you can convert meters to feet (both length), but not meters to kilograms. The API will return a 400 error for incompatible units.
Yes, we periodically add new units based on user requests. If you need a specific unit that's not currently available, please contact [email protected].