convert_unit
Convert values between 62 physics units across 16 categories including velocity, mass, energy, and temperature. Enter value, source unit, and target unit for accurate conversion.
Instructions
Convert a value from one unit to another.
Supports 62 unit types across 16 categories:
- Velocity: m/s, km/h, mph, ft/s, knots
- Distance: m, km, mi, ft, yd, in
- Mass: kg, g, lb, oz
- Force: N, kN, lbf
- Energy: J, kJ, cal, BTU, kWh
- Power: W, kW, hp
- Temperature: K, C, F
- Angle: rad, deg
- Pressure: Pa, kPa, bar, psi, atm
- Area: m², km², ft², acre
- Volume: m³, L, gal, ft³
- Time: s, min, hr, day
- Acceleration: m/s², g, ft/s²
- Torque: N·m, lb·ft, lb·in
- Frequency: Hz, kHz, MHz, GHz
- Data Size: B, KB, MB, GB
Enables natural language queries like:
- "Convert 60 mph to m/s"
- "How fast is 100 km/h in mph?"
- "Convert 10 kg to pounds"
Args:
value: The numeric value to convert
from_unit: Source unit (e.g., 'mph', 'kg', 'J')
to_unit: Target unit (e.g., 'm/s', 'lb', 'kWh')
Returns:
Dictionary with:
- original_value: Input value
- original_unit: Input unit
- converted_value: Result value
- converted_unit: Result unit
- formatted: Human-readable string
Examples:
>>> convert_unit(100, 'm/s', 'mph')
{
"original_value": 100,
"original_unit": "m/s",
"converted_value": 223.694,
"converted_unit": "mph",
"formatted": "100 m/s = 223.694 mph"
}
>>> convert_unit(60, 'mph', 'km/h')
{
"original_value": 60,
"original_unit": "mph",
"converted_value": 96.56064,
"converted_unit": "km/h",
"formatted": "60 mph = 96.56 km/h"
}
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value | Yes | ||
| from_unit | Yes | ||
| to_unit | Yes |