UnitConvert

UnitConvert[quantity,targetunit]

attempts to convert the specified quantity to the specified targetunit.

UnitConvert[quantity]

converts the specified quantity to SI base units.

Details

  • 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.

Examples

open 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:

Convert to conventionally used units:

Scope  (8)

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:

Applications  (4)

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:

Compare the volume of different barrel units:

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  (4)

UnitConvert will return $Failed for incompatible specifications, such as those between different unit dimensions:

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 2024).

Text

Wolfram Research (2012), UnitConvert, Wolfram Language function, https://reference.wolfram.com/language/ref/UnitConvert.html (updated 2024).

CMS

Wolfram Language. 2012. "UnitConvert." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/UnitConvert.html.

APA

Wolfram Language. (2012). UnitConvert. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/UnitConvert.html

BibTeX

@misc{reference.wolfram_2024_unitconvert, author="Wolfram Research", title="{UnitConvert}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/UnitConvert.html}", note=[Accessed: 30-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_unitconvert, organization={Wolfram Research}, title={UnitConvert}, year={2024}, url={https://reference.wolfram.com/language/ref/UnitConvert.html}, note=[Accessed: 30-December-2024 ]}