Help:Convert units

From the AARoads Wiki: Read about the road before you go
Jump to navigation Jump to search

Template {{convert}} is used to convert a value from one unit of measurement to another. This page documents some features of units, and lists units that are commonly used in conversions.

Default output

If no output unit is specified, the default output for the input unit will be used. Using defaults provides greater uniformity across articles.

Some options provide text that the template may mistakenly use for the output unit, if none is specified. That can be avoided by providing an empty output unit, as shown in the following examples.

  • {{convert|4|ft}} → 4 feet (1.2 m)
  • {{convert|4|ft|adj=mid|-long}} → 4-foot ([convert: unknown unit])
  • {{convert|4|ft||adj=mid|-long}} → 4-foot-long (1.2 m)

The second of the above examples produces an error because "-long" is interpreted as the name of the output unit. The third example avoids that by specifying an empty output unit which means "use the default".

The following also works, although it sets the output precision to 0.

  • {{convert|4|ft|0|adj=mid|-long}} → 4-foot-long (1 m)

The last example works because "|0" sets the output precision to zero, and convert does not look for an output unit once the precision has been specified because a precision is always given after the output unit, if any.

SI prefixes

The standard SI prefixes can applied to the following units.

Metric prefixes
Text Symbol Factor or
yotta Y 1024 1000000000000000000000000
zetta Z 1021 1000000000000000000000
exa E 1018 1000000000000000000
peta P 1015 1000000000000000
tera T 1012 1000000000000
giga G 109 1000000000
mega M 106 1000000
kilo k 103 1000
hecto h 102 100
deca da 101 10
(none) (none)  1
deci d 10−1 0.1
centi c 10−2 0.01
milli m 10−3 0.001
micro μ 10−6 0.000001
nano n 10−9 0.000000001
pico p 10−12 0.000000000001
femto f 10−15 0.000000000000001
atto a 10−18 0.000000000000000001
zepto z 10−21 0.000000000000000000001
yocto y 10−24 0.000000000000000000000001
Unit type Unit code Unit name
Area a are
m2 square metre
Charge coulomb coulomb
Energy J joule
Force N newton
Length m metre
Magnetic field strength T tesla
Mass g gram
Power W watt
Pressure Pa pascal
Radioactivity Bq becquerel
Ci curie
Time s second
Volume L litre
l litre
m3 cubic metre

Some SI prefixes are demonstrated in the following. As a convenience, "micro" can be entered as "u" instead of "μ".

  • {{convert|1.23|Gm|angstrom}} → 1.23 gigameters (1.23×1019 Å)
  • {{convert|1.23|Mm|angstrom}} → 1.23 megameters (1.23×1016 Å)
  • {{convert|1.23|Ts|hour}} → 1.23 teraseconds (340,000,000 h)
  • {{convert|1.23|nJ|Wh}} → 1.23 nanojoules (3.4×10−13 Wh)
  • {{convert|1.23|μm|in}} → 1.23 micrometers (4.8×10−5 in)
  • {{convert|1.23|um|in}} → 1.23 micrometers (4.8×10−5 in)
  • {{convert|1.23|um|uin|abbr=on}} → 1.23 μm (48 μin)
  • {{convert|18|mm|in}} → 18 millimeters (0.71 in)
  • {{convert|18|km|mi}} → 18 kilometers (11 mi)

The above demonstrates that "uin" is the unit code for microinch.

Combinations

An input unit can be converted to any number of output units—the outputs are specified as a "combination" by separating unit codes with a space (" ") or a plus ("+"). Using a space as a separator does not work if any of the unit codes contains a space.

For example, each of the following converts 1.2 km2 to acres, square yards, and hectares.

  • {{convert|1.2|km2|acre sqyd ha}} → 1.2 square kilometers (300 acres; 1,400,000 sq yd; 120 ha)
  • {{convert|1.2|km2|acre+sqyd+ha}} → 1.2 square kilometers (300 acres; 1,400,000 sq yd; 120 ha)

In the following, because "board feet" contains a space, using a space to make a combination fails.

  • {{convert|123|cuyd|m3 board feet}} → 123 cubic yards ([convert: unknown unit])
  • {{convert|123|cuyd|m3+board feet}} → 123 cubic yards (94 m3; 40,000 board feet)

The following converts a pressure to four output units. The precision is 1 (1 decimal place), and units are abbreviated and linked.

  • {{convert|895|hPa|psi inHg atm mbar|1|abbr=on|lk=on}} → 895 hPa (13.0 psi; 26.4 inHg; 0.9 atm; 895.0 mbar)

It is preferable to use "+" to separate output units when the first unit uses engineering notation; that avoids looking up the unit in Module:Convert/extra.

  • {{convert|1.2|AU|e6km+e6mi|abbr=on}} → 1.2 AU (180×10^6 km; 110×10^6 mi)
  • {{convert|1.2|AU|e6km+e6mi|abbr=unit}} → 1.2 AU (180 million km; 110 million mi)

Some "standard" combinations have been defined—see the full list of units.

Engineering notation

Most units can be combined with a scale factor, for example, e6km represents a million kilometres. The following prefixes may be used; per WP:NUMERAL, values follow the short scale. If lk is on, the numbers are linked as shown below.

Engineering notation can only be applied to simple units—temperatures, combinations, and some other special units will not work.

Some examples using engineering notation follow.

  • {{convert|123.4|e3m2}} → 123.4 thousand square meters (1.328×10^6 sq ft)
  • {{convert|123.4|e3m2|e6sqft|abbr=off}} → 123.4 thousand square meters (1.328 million square feet)
  • {{convert|1.23|e6L}} → 1.23 million liters (320,000 US gal)
  • {{convert|1.23|e6L|e3usgal|abbr=off|lk=on|sp=ca}} → 1.23 million litres (320 thousand U.S. gallons)
  • {{convert|1.23|e9impgal}} → 1.23 billion imperial gallons (5.6 Gl)
  • {{convert|1.23|e9impgal|e3usgal|abbr=off|lk=on}} → 1.23 billion imperial gallons (1,480,000 thousand US gallons)
  • {{convert|1.23|e12cuft}} → 1.23 trillion cubic feet (35×10^9 m3)

Units

Here are the most commonly used units. See below for hands or Mach. For rarer or historic units, see Module:Convert/documentation/conversion data#Conversions.

Area

Examples:

  • {{convert|1.5|sqmi|km2}} → 1.5 square miles (3.9 km2)
  • {{convert|1.5|sqmi|km2|abbr=off}} → 1.5 square miles (3.9 square kilometers)
  • {{convert|1.5|sqmi|km2|abbr=on}} → 1.5 sq mi (3.9 km2)
Unit code Unit symbol Unit name Alt name, if different
acre acre acre
ha ha hectare
m2 m2 square meter
cm2 cm2 square centimeter
km2 km2 square kilometer
sqin sq in square inch
sqft sq ft square foot
sqyd sq yd square yard
sqmi sq mi square mile

Fuel efficiency

Examples:

  • {{convert|12|mpgus|km/L}} → 12 miles per US gallon (5.1 km/L)
  • {{convert|12|mpgus|km/L|abbr=off}} → 12 miles per US gallon (5.1 kilometers per liter)
  • {{convert|12|mpgus|km/L|abbr=off|sp=ca}} → 12 miles per U.S. gallon (5.1 kilometres per litre)
  • {{convert|12|mpgus|km/L|abbr=on}} → 12 mpg‑US (5.1 km/L)
Unit code Unit symbol Unit name Alt name, if different
km/L km/L kilometer per liter kilometre per litre
mpgimp mpg‑imp mile per imperial gallon
mpgus mpg‑US mile per US gallon mile per U.S. gallon
L/km L/km liter per kilometer litre per kilometre
L/100 km L/100 km liter per 100 kilometers litre per 100 kilometres

Length

Examples:

  • {{convert|123|cm|in}} → 123 centimeters (48 in)
  • {{convert|123|cm|in|abbr=off|sp=ca}} → 123 centimetres (48 inches)
  • {{convert|123|cm|in|abbr=on}} → 123 cm (48 in)
Unit code Unit symbol Unit name Alt name, if different
uin μin microinch
in in inch
ft ft foot
yd yd yard
mi mi mile
nmi nmi nautical mile
m m meter metre
cm cm centimeter centimetre
mm mm millimeter millimetre
km km kilometer kilometre
angstrom Å ångström

Mass

Examples:

  • {{convert|72.3|kg|lb}} → 72.3 kilograms (159 lb)
  • {{convert|72.3|kg|lb|abbr=off}} → 72.3 kilograms (159 pounds)
  • {{convert|72.3|kg|lb|abbr=on}} → 72.3 kg (159 lb)
Unit code Unit symbol Unit name Alt name, if different
g g gram
kg kg kilogram
oz oz ounce
lb lb pound
st st stone
LT long ton long ton
MT t metric ton
ST short ton short ton

Pressure

Examples:

  • {{convert|28|psi|Pa}} → 28 pounds per square inch (190,000 Pa)
  • {{convert|28|psi|Pa|abbr=off}} → 28 pounds per square inch (190,000 pascals)
  • {{convert|28|psi|Pa|abbr=on}} → 28 psi (190,000 Pa)
Unit code Unit symbol Unit name Alt name, if different
atm atm standard atmosphere
mbar mbar millibar
psi psi pound per square inch
Pa Pa pascal

Speed

Examples:

  • {{convert|60|mph|km/h}} → 60 miles per hour (97 km/h)
  • {{convert|60|mph|km/h|abbr=off}} → 60 miles per hour (97 kilometers per hour)
  • {{convert|60|mph|km/h|abbr=on}} → 60 mph (97 km/h)
Unit code Unit symbol Unit name Alt name, if different
km/h km/h kilometer per hour kilometre per hour
km/s km/s kilometer per second kilometre per second
kn kn knot
mph mph mile per hour

Temperature

Examples:

  • {{convert|100|C|F}} → 100 °C (212 °F)
  • {{convert|100|C|F|abbr=off}} → 100 degrees Celsius (212 degrees Fahrenheit)
  • {{convert|100|C-change|F-change}} → 100 °C (180 °F)
  • {{convert|100|C-change|F-change|abbr=out}} → 100 degrees Celsius change (180 °F)
Unit code Unit symbol Unit name Alt name, if different
C °C degree Celsius
F °F degree Fahrenheit
K K kelvin
C-change °C degree Celsius change
F-change °F degree Fahrenheit change
K-change K kelvin change

Torque

Examples:

  • {{convert|12.5|Nm|lb.in}} → 12.5 newton-meters (111 lb⋅in)
  • {{convert|12.5|Nm|lb.in|abbr=off}} → 12.5 newton-meters (111 pound force-inchs)
  • {{convert|12.5|Nm|lb.in|abbr=on|lk=on}} → 12.5 N⋅m (111 lb⋅in)
Unit code Unit symbol Unit name Alt name, if different
lb.in lb⋅in pound force-inch
lb.ft lb⋅ft pound force-foot
Nm N⋅m newton-meter

Volume

Examples:

  • {{convert|125|cuin|l}} → 125 cubic inches (2.05 L)
  • {{convert|125|cuin|l|abbr=off}} → 125 cubic inches (2.05 liters)
  • {{convert|125|cuin|l|abbr=on}} → 125 cu in (2.05 L)
Unit code Unit symbol Unit name Alt name, if different
cuin cu in cubic inch
cuft cu ft cubic foot
cuyd cu yd cubic yard
cumi cu mi cubic mile
impgal imp gal imperial gallon
impoz imp fl oz imperial fluid ounce
usgal US gal US gallon U.S. gallon
usoz US fl oz US fluid ounce U.S. fluid ounce
L L liter litre
l L liter litre
m3 m3 cubic meter
cc cc cubic centimeter cubic centimetre
mm3 mm3 cubic millimeter


Hands (unit of length)

A hand is a unit of length used to measure the height of horses. One hand is four inches, and a value of 12.3 hands represents 12 hands + 3 inches (51 inches).

Output name

  • By default, the unit is shown as a linked name (hands).
  • The hands unit can be abbreviated to "h" or to "hh"; by default, abbreviations are not linked.
    {{convert|27|in|hand}} → 27 inches (6.3 hands)
    {{convert|27|in|hand|lk=off}} → 27 inches (6.3 hands)
    {{convert|27|in|hand|abbr=h}} → 27 in (6.3 h)
    {{convert|27|in|hand|abbr=hh}} → 27 in (6.3 hh)
    {{convert|27|in|hand|abbr=hh|lk=out}} → 27 in (6.3 hh)

Output value

  • The hands value has at most one digit after the decimal mark, and has an optional fraction.
  • A precision of 2 assumes |frac=2 (round to nearest 12 inch).
  • A precision of 3 or more assumes |frac=4 (round to nearest 14 inch).
  • If ever needed, |frac=8 can be used to round to the nearest 18 inch.
    {{convert|27.63|in|hand}} → 27.63 inches (7.0 hands)
    {{convert|27.63|in|hand|0}} → 27.63 inches (7 hands)
    {{convert|27.63|in|hand|1}} → 27.63 inches (7.0 hands)
    {{convert|27.63|in|hand|2}}27.63 inches (6.3+12 hands)
    {{convert|27.63|in|hand|3}}27.63 inches (6.3+34 hands)
    {{convert|27.63|in|hand|frac=8}}27.63 inches (6.3+58 hands)
    {{convert|28.5|in|hand|2}}28.5 inches (7.0+12 hands)
    {{convert|28.5|in|hand|3}}28.5 inches (7.0+12 hands)

Output in hands and inches

  • When using "hand in" to convert to hands and inches, the rounded hands and inches values are equivalent, and use the same fraction, if any.
  • Special rounding of the inches value only occurs when "hand in" is the output. For example, if the output is "in hand", the inches value is rounded independently from the hands value.
    {{convert|156|cm|hand in}} → 156 centimeters (15.1 hands; 61 in)
    {{convert|156|cm|hand in|2}}156 centimeters (15.1+12 hands; 61+12 in)
    {{convert|156|cm|in hand}} → 156 centimeters (61 in; 15.1 hands)
    {{convert|156|cm|in hand|2}}156 centimeters (61.42 in; 15.1+12 hands)
    {{convert|156|cm|hand in|abbr=out}} → 156 centimeters (15.1 h; 61 in)
    {{convert|156|cm|hand in|abbr=h}} → 156 cm (15.1 h; 61 in)
    {{convert|156|cm|hand in|abbr=hh}} → 156 cm (15.1 hh; 61 in)

Ranges

  • A range of values can be indicated with "-" (hyphen) or "to". When a dash is displayed by convert, it is always an en dash.
  • Alternatively, "and" and "or" can be used.
    {{convert|137|-|156|cm|hand in}} → 137–156 centimeters (13.2–15.1 hands; 54–61 in)
    {{convert|137|-|156|cm|hand in|2}}137–156 centimeters (13.2–15.1+12 hands; 54–61+12 in)
    {{convert|137|-|156|cm|hand in|abbr=in}} → 137–156 cm (13.2–15.1 hands; 54–61 inches)
    {{convert|137|-|156|cm|hand in|abbr=h}} → 137–156 cm (13.2–15.1 h; 54–61 in)
    {{convert|137|-|156|cm|hand in|abbr=on}} → 137–156 cm (13.2–15.1 h; 54–61 in)
    {{convert|137|and|156|cm|hand in|abbr=on}} → 137 and 156 cm (13.2 and 15.1 h; 54 and 61 in)
    {{convert|137|or|156|cm|hand in|abbr=on}} → 137 or 156 cm (13.2 or 15.1 h; 54 or 61 in)

Examples

  • The following examples illustrate various combinations of options.
    {{convert|57|in|hand}} → 57 inches (14.1 hands)
    {{convert|2|m|hand}} → 2 meters (19.3 hands)
    {{convert|137|cm|hand|2}} → 137 centimeters (13.2 hands)
    {{convert|137|cm|hand|2|sp=ca}} → 137 centimetres (13.2 hands)
    {{convert|14.1|hand|in}} → 14.1 hands (57 inches)
    {{convert|14.1|hand|cm}} → 14.1 hands (145 cm)
    {{convert|14.1|hand|in cm}} → 14.1 hands (57 inches; 145 cm)
    {{convert|14.1|hand|cm in}} → 14.1 hands (145 cm; 57 inches)
    {{convert|14.1|-|14.3|hand|cm}} → 14.1–14.3 hands (145–150 cm)
    {{convert|14.1|-|14.3|hand|in cm}} → 14.1–14.3 hands (57–59 inches; 145–150 cm)
    {{convert|50|-|57|in|hand}} → 50–57 inches (12.2–14.1 hands)
    {{convert|2|-|3|m|hand}} → 2–3 meters (19.3–29.2 hands)
    {{convert|57|or|59|in|hand|abbr=on}} → 57 or 59 in (14.1 or 14.3 h)
    {{convert|137|-|139|cm|hand|lk=on}} → 137–139 centimeters (13.2–13.3 hands)
    {{convert|137|and|162|cm|hand|0|abbr=in|lk=in}} → 137 and 162 cm (13 and 16 hands)
    {{convert|137|and|162|cm|hand in}} → 137 and 162 centimeters (13.2 and 16.0 hands; 54 and 64 in)
    {{convert|9.2|hand}} → 9.2 hands (38 inches; 97 cm)
    {{convert|9.2|hand|lk=off}} → 9.2 hands (38 inches; 97 cm)
    {{convert|9.2|hand|abbr=h}} → 9.2 h (38 in; 97 cm)
    {{convert|9.2|hand|abbr=h|lk=in}} → 9.2 h (38 in; 97 cm)
    {{convert|9.2|hand|abbr=hh|lk=in}} → 9.2 hh (38 in; 97 cm)
    {{convert|9.2+1/2|hand}}9.2+12 hands (38.5 inches; 98 cm)
    {{convert|9.2+3/4|hand}}9.2+34 hands (38.75 inches; 98 cm)
    {{convert|9.2+3/4|hand|abbr=h}}9.2+34 h (38.75 in; 98 cm)
    {{convert|9.2+3/4|hand|cm in}}9.2+34 hands (98 cm; 38.75 inches)
    {{convert|9.2+3/4|hand|cm in|abbr=out}}9.2+34 hands (98 cm; 38.75 in)
    {{convert|9.2+3/4|hand|cm in|abbr=on}}9.2+34 h (98 cm; 38.75 in)
    {{convert|9.2+3/4|hand|in}}9.2+34 hands (38.75 inches)
    {{convert|9.2+3/4|hand|in|abbr=out}}9.2+34 hands (38.75 in)
    {{convert|9.2+3/4|hand|in|abbr=on}}9.2+34 h (38.75 in)
    {{convert|15.1|-|16.3|hand}} → 15.1–16.3 hands (61–67 inches; 155–170 cm)
    {{convert|14.2|to|16.1|hand}} → 14.2 to 16.1 hands (58 to 65 inches; 147 to 165 cm)

Mach (unit of speed)

Conversion of the Mach unit of speed depends on the altitude at which the speed is measured. That altitude should be specified either in feet (for example, |altitude_ft=10,000) or in metres (for example, |altitude_m=3,749). The altitude cannot be determined accurately and only a whole number is accepted.

Examples:

  • {{convert|1.6|Mach|altitude_ft=20,000|mph}} → Mach 1.6 (1,130 mph)
  • {{convert|1.6|Mach|altitude_m=6,096|mph}} → Mach 1.6 (1,130 mph)
  • {{cvt|1130|mph|Mach|altitude_m=6,096|lk=out}} → 1,130 mph (Mach 1.6)
  • {{convert|5|-|7|Mach|altitude_ft=34,500}} → Mach 5 – Mach 7 (5,300–7,500 km/h; 3,300–4,600 mph)