-
See Also
- Quantity
- UnitSimplify
- CommonUnits
- QuantityMagnitude
- UnitDimensions
- CompatibleUnitQ
- ChemicalConvert
-
- Entity Types
- PhysicalQuantity
-
- Interpreter Types
- Quantity
- Related Guides
- Workflows
- Tech Notes
-
-
See Also
- Quantity
- UnitSimplify
- CommonUnits
- QuantityMagnitude
- UnitDimensions
- CompatibleUnitQ
- ChemicalConvert
-
- Entity Types
- PhysicalQuantity
-
- Interpreter Types
- Quantity
- Related Guides
- Workflows
- Tech Notes
-
See Also
UnitConvert[quantity,targetunit]
attempts to convert the specified quantity to the specified targetunit.
UnitConvert[quantity]
converts the specified quantity to SI base units.
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 all close allBasic Examples (4)
Convert from miles to kilometers:
UnitConvert[Quantity[8.2, "Miles"], "Kilometers"]Convert a Quantity object to the appropriate SI base units:
UnitConvert[Quantity[3.8, "Pounds"]]UnitConvert[["3 pascal"]]Convert the speed of light to SI base units:
UnitConvert[["speed of light"]]Convert to conventionally used units:
UnitConvert[Quantity[8.91197525066558*^9, "Inches"], "Conventional"]UnitConvert[Quantity[3.482834*^12, ("Kilograms"*"Meters"^2)/"Seconds"^2], "Conventional"]UnitConvert[Quantity[0.000186, "Inches"^3], "Conventional"]Scope (8)
UnitConvert operates on lists of Quantity expressions:
UnitConvert[{["3 ft"], ["8 meters"]}, "Inches"]UnitConvert[{{Quantity[3, "Feet"], {Quantity[8, "Meters"]}}, {Quantity[3, "Feet"], Quantity[8, "Meters"]}}, "Inches"]Convert Quantity expressions to their equivalent SI units:
UnitConvert[Quantity[1, "AtomicMassUnit"]]UnitConvert[{Quantity[3., "Feet"], Quantity[8., "Inches"], Quantity[3., "Pounds"], Quantity[8., "Ounces"]}, "SI"]Get the SI unit value of a physical constant:
UnitConvert[Quantity[1, "GravitationalConstant"]]Convert the values of a time series:
data = SunPosition[DateRange[DateObject[{2013, 1, 1}, "Day", "Gregorian", -6.], DateObject[{2013, 12, 31}, "Day", "Gregorian", -6.], 10]]data[{2013, 1, 20}]UnitConvert[data, "Radians"]%[{2013, 1, 20}]Convert the Quantity values of an association to SI base units:
data = EntityValue[Entity["Volcano", "Kos"], "PropertyAssociation"]UnitConvert[data]Convert the unit of a QuantityDistribution expression:
𝒟 = TriangularDistribution[{Quantity[55, "Miles"/"Hours"], Quantity[82, "Miles"/"Hours"]}, Quantity[72, "Miles"/"Hours"]]UnitConvert[𝒟]UnitConvert accepts structured arrays like QuantityArray or SymmetrizedArray objects:
UnitConvert[
QuantityArray[{1, 2, 3}, "Kilometers" ^ 2], "Dekameters" ^ 2]UnitConvert[
SymmetrizedArray[{{1, 1} -> Quantity[2, "Liters"], {2, 1} -> Quantity[3, "Newtons"]}, {2, 2}, Symmetric[{1, 2}]]]UnitConvert accepts Association specifications:
UnitConvert[<|"Distance" -> Quantity[260, "Miles"], "Duration" -> Quantity[3, "Hours"]|>]Applications (4)
Use UnitConvert to examine the value of a unit in the "SIBase" unit system:
UnitConvert[Quantity[1, "Tablespoons"]]UnitConvert[Quantity[1, "Jins"]]UnitConvert[Quantity[1, "Bans"]]Use UnitConvert to find the value of a unit derived from SI base units:
UnitConvert[["1 BoltzmannConstant"]]UnitConvert[["1 PlanckConstant"]]UnitConvert[["1 c"]]Find the range of masses in kilograms for different objects, from the universe to an electron:
UnitConvert[<|"Universe" -> Quantity[1, "UniverseMass"], "Sun" -> Quantity[1, "SolarMass"], "Earth" -> Quantity[1, "EarthMass"], "Electron" -> Quantity[1, "ElectronMass"]|>, "Kilograms"]Compare the volume of different barrel units:
barrels = {"Barrels", "BarrelsBeer", "BarrelsBeerUK", "BarrelsHerringVolume", "BarrelsOfOil", "BarrelsSand", "BarrelsSugar", "BarrelsUK", "BulkBarrels", "DryBarrels", "ReservoirBarrels", "StockTankBarrels"};
UnitConvert[AssociationThread[barrels -> barrels], "Liters"]//NBarChart[QuantityMagnitude[Quantity /@ barrels, "Gallons"], ChartLabels -> Placed[barrels, Bottom, Rotate[#, 90 Degree]&], AxesLabel -> "Gallons"]Properties & Relations (9)
The first argument of UnitConvert can be given as a unit string:
UnitConvert["Grays"]UnitConvert["Joules"]The targetunit specification can be a product or quotient of strings:
UnitConvert[Quantity[1, "Joules"], "Newtons" * "Centimeters"]UnitConvert[Quantity[1, "Kilograms"/"Meters"^3], "Ounces" / "Feet" ^ 3]An independent unit can only be converted to itself and multiples or submultiples of itself:
UnitConvert[Quantity[12, "Kilo"*IndependentUnit["Stamps"]]]UnitConvert[Quantity[1, "Mega"*IndependentUnit["Coins"]], "Kilo"IndependentUnit["Coins"]]The second argument of UnitConvert can be a MixedUnit specification:
UnitConvert[Quantity[50000, "Seconds"],
MixedUnit[{"Hours", "Minutes", "Seconds"}]]The units given in a MixedUnit specification do not need to be ordered:
UnitConvert[Quantity[50000, "Seconds"],
MixedUnit[{"Seconds", "Hours", "Minutes"}]]UnitConvert can convert mixed Quantity objects:
Quantity[MixedMagnitude[{5, 10}], MixedUnit[{"Feet", "Inches"}]]UnitConvert[%, MixedUnit[{"Meters", "Centimeters"}]]UnitConvert will automatically attempt to interpret an unknown unit string:
KnownUnitQ["OddCandle"]UnitConvert[Quantity[1, "Candelas"], "OddCandle"]KnownUnitQ["OldCandle"]When the target unit is specified as a Quantity object, its magnitude will be ignored:
UnitConvert[Quantity[100, "Yards"], "Meters"]UnitConvert[Quantity[100, "Yards"], Quantity[100, "Meters"]]The "SIBase" unit for "InformationUnit" is "Bits":
UnitConvert[Quantity[16, "Gigaoctets"]]The "SIBase" unit for "MoneyUnit" is "USDollars":
UnitConvert[Quantity[100, "BritishPounds"]]UnitConvert threads over lists:
UnitConvert[{Quantity[7, "Minutes"], Quantity[9, "Daltons"], Quantity[2, "Cups"]}]UnitConvert[{Quantity[7., "Meters"], {Quantity[8., "Kilograms"]}, Quantity[5., "Meters"^3]}, "Imperial"]Possible Issues (4)
UnitConvert will return $Failed for incompatible specifications, such as those between different unit dimensions:
UnitConvert[Quantity[8, "Feet"], "Pounds"]UnitConvert[{Quantity[3, "Feet"], Quantity[6, "Pounds"]}, "Inches"]UnitConvert[q,"SIBase"] typically converts all units to their SI base units:
UnitConvert[Quantity[3, "Farads"], "SIBase"]For special cases where no SI unit is standard for the dimension, non-SI units are permitted in SI base form:
UnitConvert[Quantity[3, "Radians"], "SIBase"]UnitConvert[Quantity[3, "Steradians"], "SIBase"]UnitConvert[Quantity[3, "Euros"], "SIBase"]When converting from a temperature to a temperature difference, the result will be given as a temperature difference from absolute zero:
UnitConvert[Quantity[3., "DegreesFahrenheit"], "DegreesCelsiusDifference"]UnitConvert[Quantity[3., "DegreesFahrenheit"]] - Quantity[0, "Kelvins"]Conversions from temperature differences to temperatures are not permitted:
UnitConvert[Quantity[3., "DegreesCelsiusDifference"], "DegreesFahrenheit"]See Also
Quantity UnitSimplify CommonUnits QuantityMagnitude UnitDimensions CompatibleUnitQ ChemicalConvert
Entity Types: PhysicalQuantity
Interpreter Types: Quantity
Function Repository: UnitAdjust StoneyUnitConversion
Tech Notes
Related Workflows
- Calculate with Units ▪
- Enter Quantities with Units
Related Links
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_2026_unitconvert, author="Wolfram Research", title="{UnitConvert}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/UnitConvert.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_unitconvert, organization={Wolfram Research}, title={UnitConvert}, year={2024}, url={https://reference.wolfram.com/language/ref/UnitConvert.html}, note=[Accessed: 13-June-2026]}