attempts to convert the specified quantity to the specified targetunit.
converts the specified quantity to SI base units.
- The targetunit can be a canonical unit or a Quantity expression.
- When targetunit is a Quantity, the resulting output will have the same unit as targetunit.
- A targetunit specification can also be one of the following unit systems: "SIBase", "SI", "Imperial", "Conventional" or "Metric".
- UnitConvert can separately convert temperatures and temperature differences. Temperatures are also converted into temperature differences by interpreting them as differences with respect to absolute zero.
- UnitConvert accepts TimeSeries, EventSeries, and TemporalData inputs and attempts to convert Quantity values to the specified targetunit.
- UnitConvert accepts Association inputs and attempts to convert Quantity values to the specified targetunit.
- An internet connection is required for conversion between currency units.
Examplesopen allclose all
Basic Examples (4)
Convert from miles to kilometers:
Convert a Quantity object to the appropriate SI base units:
Convert the speed of light to SI base units:
UnitConvert operates on lists of Quantity expressions:
Convert Quantity expressions to their equivalent SI units:
Get the SI unit value of a physical constant:
Convert the values of a time series:
Convert the Quantity values of an association to SI base units:
Convert the unit of a QuantityDistribution expression:
UnitConvert accepts structured arrays like QuantityArray or SymmetrizedArray objects:
UnitConvert accepts Association specifications:
Use UnitConvert to examine the value of a unit in the "SIBase" unit system:
Use UnitConvert to find the value of a unit derived from SI base units:
Find the range of masses in kilograms for different objects, from the universe to an electron:
Properties & Relations (9)
The first argument of UnitConvert can be given as a unit string:
The targetunit specification can be a product or quotient of strings:
An independent unit can only be converted to itself and multiples or submultiples of itself:
The second argument of UnitConvert can be a MixedUnit specification:
The units given in a MixedUnit specification do not need to be ordered:
UnitConvert can convert mixed Quantity objects:
UnitConvert will automatically attempt to interpret an unknown unit string:
When the target unit is specified as a Quantity object, its magnitude will be ignored:
The "SIBase" unit for "InformationUnit" is "Bits":
The "SIBase" unit for "MoneyUnit" is "USDollars":
UnitConvert threads over lists:
Possible Issues (5)
UnitConvert will return $Failed for incompatible specifications, such as those between different unit dimensions:
Conversion to a unit system will return a unit that exists in that unit system, not necessarily the base unit of that system:
UnitConvert[q,"SIBase"] typically converts all units to their SI base units:
For special cases where no SI unit is standard for the dimension, non-SI units are permitted in SI base form:
When converting from a temperature to a temperature difference, the result will be given as a temperature difference from absolute zero:
Conversions from temperature differences to temperatures are not permitted:
Wolfram Research (2012), UnitConvert, Wolfram Language function, https://reference.wolfram.com/language/ref/UnitConvert.html (updated 2022).
Wolfram Language. 2012. "UnitConvert." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/UnitConvert.html.
Wolfram Language. (2012). UnitConvert. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/UnitConvert.html