Help:Convert units

From Roses, Tulips, & Liberty

Template:Wikipedia how-to 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 Template:Gaps
zetta Z 1021 Template:Gaps
exa E 1018 Template:Gaps
peta P 1015 Template:Gaps
tera T 1012 Template:Gaps
giga G 109 Template:Gaps
mega M 106 Template:Gaps
kilo k 103 Template:Gaps
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 Template:Gaps
nano n 10−9 Template:Gaps
pico p 10−12 Template:Gaps
femto f 10−15 Template:Gaps
atto a 10−18 Template:Gaps
zepto z 10−21 Template:Gaps
yocto y 10−24 Template:Gaps
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 gigametres (1.23×1019 Å)
  • {{convert|1.23|Mm|angstrom}} → 1.23 megametres (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 micrometres (4.8×10−5 in)
  • {{convert|1.23|um|in}} → 1.23 micrometres (4.8×10−5 in)
  • {{convert|1.23|um|uin|abbr=on}} → 1.23 μm (48 μin)
  • {{convert|18|mm|in}} → 18 millimetres (0.71 in)
  • {{convert|18|km|mi}} → 18 kilometres (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 kilometres (300 acres; 1,400,000 sq yd; 120 ha)
  • {{convert|1.2|km2|acre+sqyd+ha}} → 1.2 square kilometres (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 metres (1.328×10^6 sq ft)
  • {{convert|123.4|e3m2|e6sqft|abbr=off}} → 123.4 thousand square metres (1.328 million square feet)
  • {{convert|1.23|e6L}} → 1.23 million litres (320,000 US gal)
  • {{convert|1.23|e6L|e3usgal|abbr=off|lk=on|sp=us}} → 1.23 million liters (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. Script error: No such module "convert/show".

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

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 centimetres (15.1 hands; 61 in)
    {{convert|156|cm|hand in|2}}Page Template:Fraction/styles.css has no content.156 centimetres (15.1+12 hands; 61+12 in)
    {{convert|156|cm|in hand}} → 156 centimetres (61 in; 15.1 hands)
    {{convert|156|cm|in hand|2}}Page Template:Fraction/styles.css has no content.156 centimetres (61.42 in; 15.1+12 hands)
    {{convert|156|cm|hand in|abbr=out}} → 156 centimetres (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 centimetres (13.2–15.1 hands; 54–61 in)
    {{convert|137|-|156|cm|hand in|2}}Page Template:Fraction/styles.css has no content.137–156 centimetres (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 metres (19.3 hands)
    {{convert|137|cm|hand|2}} → 137 centimetres (13.2 hands)
    {{convert|137|cm|hand|2|sp=us}} → 137 centimeters (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 metres (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 centimetres (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 centimetres (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}}Page Template:Fraction/styles.css has no content.9.2+12 hands (38.5 inches; 98 cm)
    {{convert|9.2+3/4|hand}}Page Template:Fraction/styles.css has no content.9.2+34 hands (38.75 inches; 98 cm)
    {{convert|9.2+3/4|hand|abbr=h}}Page Template:Fraction/styles.css has no content.9.2+34 h (38.75 in; 98 cm)
    {{convert|9.2+3/4|hand|cm in}}Page Template:Fraction/styles.css has no content.9.2+34 hands (98 cm; 38.75 inches)
    {{convert|9.2+3/4|hand|cm in|abbr=out}}Page Template:Fraction/styles.css has no content.9.2+34 hands (98 cm; 38.75 in)
    {{convert|9.2+3/4|hand|cm in|abbr=on}}Page Template:Fraction/styles.css has no content.9.2+34 h (98 cm; 38.75 in)
    {{convert|9.2+3/4|hand|in}}Page Template:Fraction/styles.css has no content.9.2+34 hands (38.75 inches)
    {{convert|9.2+3/4|hand|in|abbr=out}}Page Template:Fraction/styles.css has no content.9.2+34 hands (38.75 in)
    {{convert|9.2+3/4|hand|in|abbr=on}}Page Template:Fraction/styles.css has no content.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}}Template:Cvt
  • {{convert|5|-|7|Mach|altitude_ft=34,500}} → Mach 5 – Mach 7 (5,300–7,500 km/h; 3,300–4,600 mph)

Template:Convert/documentation navbox