The Wolfram Language has sophisticated built-in functions for computing with, converting and analyzing quantities with units.

Put quantities with units into your Inputs

Enter quantities with units using either natural language input or Quantity. See Enter Quantities with Units for details:

Convert to different units if necessary

Use UnitConvert to convert to different units if necessary:

Extract quantities without units

  • The second argument to QuantityMagnitude is optional, but it is safest to specify it explicitly if the first argument is a computation, since units may change in the course of a computation.

Notes

For large arrays of quantities with units, use QuantityArray for the best computational and representational efficiency:
In[5]:=
Click for copyable input
Out[5]=
Some computations whose inputs do not have units yield outputs with units:
In[6]:=
Click for copyable input
Out[6]=
Natural language queries often return quantities with units:
In[7]:=
Click for copyable input
Out[7]=
Many Wolfram Language functions work properly with inputs that have units:
In[8]:=
Click for copyable input
Out[8]=
In contrast to most units, dimensionless units behave like numbers in many situations:
In[9]:=
Click for copyable input
Out[9]=
In[10]:=
Click for copyable input
Out[10]=
In[11]:=
Click for copyable input
Out[11]=