Convert Units
Convert units from one to another. The API returns the amount and the unit of the target unit.
For each type, there are many units that can be converted to each other. For example, for the type "bandwidth", you can convert from "bit/s" to "kb/s", "mb/s", "gb/s" and so on. Here's a list of physical unit types understood and convertable by the API:
- Bandwidth (bit/s, kb/s...)
- Time (hours, minutes, seconds...)
- Digital (byte, megabyte...)
- Frequency (Hz, kHz...)
- Rotation Speed (rpm...)
- Length (miles, centimeters, nanometers...)
- Area (sqft, m²...)
- Temperature (celsius, fahrenheit, °C...)
- Area Density (g/m²...)
- Density (kg/m³...)
- Volume (liter, gallons, cm³...)
- Power Ratio (dB, decibel...)
- Weight (grams, lbs, tons...)
- Force (N, Newton...)
- Speed (km/h, mph...)
- Pressure (pascal, hPa...)
- Electrical Resistance (ohm, Ω...)
- Power (W, Watt, kW...)
- Voltage (volts, mV...)
- Energy (kilojoule, calories, kcal...)
- Current (ampere, amp...)
- Electric Charge (ampere-hour, Ah...)
- Torque (Nm, ft-pdl, mkgf...)
- Pixel (pixel, megapixel...)
- Luminance (nit, cd/m²...)
- Luminous Flux (lumen, lm...)
- Flow Rate (m³/s, us gpm, gallons per minute...)
Additionally, you can convert food amounts and the correct food density will be used to convert the amount. For example, you can convert from "1 cup of flour" to "grams" or "ounces". Given "flour" as the food name, you will get a different conversion than using oil or water for instance as the densities are very different from flour.
GET
https://api.apileague.com/convert-units
GET
https://api.apileague.com/{{ examples.getConvertUnits }}
{
"target_amount": 220.46226218487757,
"target_unit": "lb"
}
cURL
Java
Javascript
Python
Go
C#
{{ codeCopyText }}
{{ codeCopyText }}
{{ codeCopyText }}
{{ codeCopyText }}
{{ codeCopyText }}
{{ codeCopyText }}