LIVE API

Unit Converter API

Convert between different units of measurement including length, weight, temperature, digital storage, and more. Simple, accurate, and reliable unit conversions.

GET https://convert.freeapi.me/convert?value=100&from=c&to=f

{
  "originalValue": 100,
  "fromUnit": "c",
  "convertedValue": 212,
  "toUnit": "f"
}

Documentation

Base URL

https://convert.freeapi.me/

All API requests should be made to this endpoint. HTTPS is required for all API calls.

Endpoints

Endpoint Method Description
/convert GET Convert a value from one unit to another
/help GET Get detailed information about supported units and usage examples
/ GET Root endpoint, same as /help

Parameters for /convert

The following query parameters can be used with the /convert endpoint:

Parameter Type Description
value number Required. The numerical value to convert.
from string Required. The source unit to convert from (e.g., "km", "lb", "c").
to string Required. The target unit to convert to (e.g., "miles", "kg", "f").
roundoptional integer Number of decimal places to round the result to. Must be a non-negative integer.

Example Requests

# Convert 10 kilometers to miles
curl "https://convert.freeapi.me/convert?value=10&from=km&to=miles"

# Convert 100 Celsius to Fahrenheit, rounded to 1 decimal place
curl "https://convert.freeapi.me/convert?value=100&from=c&to=f&round=1"

# Convert 1.5 GB to MB
curl "https://convert.freeapi.me/convert?value=1.5&from=GB&to=MB"
// Convert 10 kilometers to miles
fetch('https://convert.freeapi.me/convert?value=10&from=km&to=miles')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

// Convert with rounding
fetch('https://convert.freeapi.me/convert?value=100&from=c&to=f&round=1')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
import requests

# Convert 10 kilometers to miles
response = requests.get('https://convert.freeapi.me/convert',
                        params={'value': 10, 'from': 'km', 'to': 'miles'})
data = response.json()
print(data)

# Convert with rounding
response = requests.get('https://convert.freeapi.me/convert',
                        params={'value': 100, 'from': 'c', 'to': 'f', 'round': 1})
data = response.json()
print(data)
// Convert 10 kilometers to miles
$url = 'https://convert.freeapi.me/convert?value=10&from=km&to=miles';
$response = file_get_contents($url);
$data = json_decode($response, true);
print_r($data);

// Convert with rounding
$url = 'https://convert.freeapi.me/convert?value=100&from=c&to=f&round=1';
$response = file_get_contents($url);
$data = json_decode($response, true);
print_r($data);

Response Format

The API returns a JSON object with details about the conversion:

{
  "originalValue": 10,         // The input value provided
  "fromUnit": "km",            // The source unit (canonical form)
  "convertedValue": 6.21371,   // The converted result
  "toUnit": "miles",           // The target unit (canonical form)
  "roundingPlaces": 2          // Only included if rounding was applied
}

Error Responses

The API may return the following error responses:

  • 400 Bad Request - Returned if parameters are missing or invalid
  • 404 Not Found - Returned for undefined endpoints
  • 405 Method Not Allowed - Returned if using a method other than GET

Error response format:

{
  "error": "Detailed error message explaining what went wrong"
}

Supported Unit Categories

The API supports conversion between units within the following categories. Units can only be converted within the same category.

Length

Units for measuring distance or linear dimensions

km
m
cm
miles
ft
in

Weight

Units for measuring mass

kg
g
lbs
oz

Temperature

Units for measuring temperature

c (Celsius)
f (Fahrenheit)
k (Kelvin)

Computer Storage

Units for measuring digital information storage (Base 1000)

b (bit)
B (byte)
KB
MB
GB
TB
PB

Network Speed

Units for measuring data transfer rates (Base 1000)

bps
kbps
Mbps
Gbps
Tbps

Time

Units for measuring time durations

ns
us
ms
s
min
h
d
wk

Liquid Volume

Units for measuring liquid capacity

ml
l
fl_oz
cup
pt
qt
gal

Area

Units for measuring two-dimensional space

sqm
sqkm
sqft
sqmi
ha
acre

Unit Aliases

The API supports various aliases for the same unit. For example, you can use "km", "kilometer", or "kilometers" interchangeably. For a complete list of supported units and their aliases, you can make a request to the /help endpoint.

GET https://convert.freeapi.me/help