Help:Convert

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Template {{convert}} is used to convert a value from one unit of measurement to another. This page provides an overview of the options available when using the template.

Asking questions[edit]

Units[edit]

Quick start[edit]

By default, the name of the input unit is shown, while the output is abbreviated using the unit's symbol. If wanted, names or symbols can be used, and the output precision can be specified.

  • {{convert|123.4|ft|m}} → 123.4 feet (37.6 m)
  • {{convert|123.4|ft|m|abbr=on}} → 123.4 ft (37.6 m)
  • {{convert|123.4|ft|m|abbr=off}} → 123.4 feet (37.6 metres)
  • {{convert|123.4|ft|m|abbr=off|sp=us}} → 123.4 feet (37.6 meters)
  • {{convert|123.4|ft|m|0}} → 123.4 feet (38 m)
  • {{convert|123.4|ft|m|3}} → 123.4 feet (37.612 m)

To avoid overlinking, units are not normally linked, but they can be when needed.

  • {{convert|12300|m2|rood|abbr=off|lk=on}} → 12,300 square metres (12.2 roods)
  • {{convert|12300|m2|rood|abbr=off|lk=out}} → 12,300 square metres (12.2 roods)

A convert can be used in an adjectival phrase, and user-specified text can be inserted.

  • {{convert|1500|ft|m|adj=on}} → 1,500-foot (460 m)
  • {{convert|1500|ft|m|adj=mid|-long}} → 1,500-foot-long (460 m)

If no output unit is specified, a default is used.

  • {{convert|123.4|ft}} → 123.4 feet (37.6 m)
  • {{convert|123.4|ft|abbr=on}} → 123.4 ft (37.6 m)
  • {{convert|1500|ft||adj=mid|-long}} → 1,500-foot-long (460 m)

The last example used || to explicitly show that the output unit has been omitted. If that is not done, the result is an error, and holding the mouse over the error message shows that "-long" is misinterpreted as the output unit.

The input and outputs can be "flipped". When flipped, an option such as |lk=out means "link the right-hand side".

  • {{convert|12300|m2|rood|abbr=off|lk=out}} → 12,300 square metres (12.2 roods)
  • {{convert|12300|m2|rood|abbr=off|lk=out|disp=flip}} → 12.2 roods (12,300 square metres)
  • {{convert|12300|m2|rood|abbr=off|lk=in|disp=flip}} → 12.2 roods (12,300 square metres)

The input value can be spelled.

  • {{convert|5|mi|km|spell=in|0}} → five miles (8 km)
  • {{convert|5|mi|km|spell=In|0}} → Five miles (8 km)

Ranges of values are supported.

  • {{convert|3|-|6|ft}} → 3–6 feet (0.91–1.83 m)
  • {{convert|3|to|6|ft|abbr=off|sp=us}} → 3 to 6 feet (0.91 to 1.83 meters)

A range can use more than two values.

  • {{convert|100|x|120|x|210|mm|in}} → 100 by 120 by 210 millimetres (3.9 × 4.7 × 8.3 in)
  • {{convert|100|x|120|x|210|mm|in|abbr=on}} → 100 × 120 × 210 mm (3.9 × 4.7 × 8.3 in)
  • {{convert|100|by|120|by|210|mm|in}} → 100 by 120 by 210 millimetres (3.9 by 4.7 by 8.3 in)

Some input units consist of multiple components.

  • {{convert|5|ft|8|in}} → 5 feet 8 inches (1.73 m)
  • {{convert|11|st|3|lb|kg}} → 11 stone 3 pounds (71 kg)

An output can be a combination of several units.

  • {{convert|123|nmi|km mi}} → 123 nautical miles (228 km; 142 mi)
  • {{convert|123|hPa|psi inHg|abbr=on|lk=on}} → 123 hPa (1.78 psi; 3.6 inHg)

Some outputs consist of multiple units.

  • {{convert|123.4|m|ydftin}} → 123.4 metres (134 yd 2 ft 10 in)
  • {{convert|123.4|kg|stlb}} → 123.4 kilograms (19 st 6 lb)

Rounding[edit]

By default, the output value is rounded to adjust its precision to match that of the input. An input such as 1234 is interpreted as 1234 ± 0.5, while 1200 is interpreted as 1200 ± 50, and the output value is displayed accordingly, taking into account the scale factor used in the conversion.

If the default is not wanted, the precision of output values can be specified using:

  • |N (where N is a number) to specify the number of digits to be displayed after the decimal mark (round output to N decimal places).
  • |-N (where -N is a negative number) to specify the number of digits before the decimal mark that should be replaced with zero (round output to nearest 10N).
  • |sigfig=N (where N is a positive number) to specify the number of significant digits (round output to N significant figures).
  • |round=5 to round the output to the nearest multiple of 5.

Examples:

  • {{convert|1234|ft|m}} → 1,234 feet (376 m)
  • {{convert|1234|ft|m|2}} → 1,234 feet (376.12 m)
  • {{convert|1234|ft|m|-1}} → 1,234 feet (380 m)
  • {{convert|1234|ft|m|round=5}} → 1,234 feet (375 m)
  • {{convert|1234|ft|m|sigfig=2}} → 1,234 feet (380 m)
  • {{convert|1234|ft|m|sigfig=4}} → 1,234 feet (376.1 m)
  • {{convert|1230|ft|m}} → 1,230 feet (370 m)
  • {{convert|1230|ft|m|0}} → 1,230 feet (375 m)
  • {{convert|1230|ft|m|1}} → 1,230 feet (374.9 m)
  • {{convert|5670|sqft}} → 5,670 square feet (527 m2)
  • {{convert|5670|sqft|-2}} → 5,670 square feet (500 m2)

Spell[edit]

Use US (en-US) spelling for unit names

Use |sp=us to specify that unit names should be displayed with US spelling:

  • {{convert|6|km}} → 6 kilometres (3.7 mi)
  • {{convert|6|km|sp=us}} → 6 kilometers (3.7 mi)
Spell out numbers in words

Use |spell=in to specify that the input value should be spelled in words, or |spell=In (uppercase "I") to start with an uppercase letter:

  • {{convert|5|mi|km|spell=in}} → five miles (8.0 km)
  • {{convert|5|mi|km|spell=in|abbr=off|0}} → five miles (8 kilometres)
  • {{convert|5|mi|km|spell=In|0}} → Five miles (8 km)
  • {{convert|5|mi|km|spell=In|abbr=off|0}} → Five miles (8 kilometres)
  • {{convert|2+1/4|mi|km|abbr=off|0|spell=In}} → Two and a quarter miles (4 kilometres)
  • {{convert|2+1/4|mi|km|abbr=off|0|spell=In|sp=us}} → Two and a fourth miles (4 kilometers)

The input and output can be "flipped", as shown in these examples. Logically, the resulting first number is spelled:

  • {{convert|5|mi||0|disp=flip|spell=in}} → eight kilometres (5 mi)
  • {{convert|5|mi||0|disp=flip|spell=In|abbr=off}} → Eight kilometres (5 miles)

The "||" provides an empty output unit to mean "use the default".

Both input and output values can be spelled:

  • {{convert|5|mi|m|-2|spell=on|sp=us|abbr=off}} → five miles (eight thousand meters)
  • {{convert|5|mi|m|-2|spell=On|sp=us|abbr=off}} → Five miles (eight thousand meters)

Thousands separator[edit]

In input, a comma for thousands separator is accepted. In output, by default, the thousands separator is the comma:

  • {{convert|1234567|m|ft}} → 1,234,567 metres (4,050,417 ft)
  • {{convert|1,234,567|m|ft}} → 1,234,567 metres (4,050,417 ft)

Set |comma=off to remove any thousands separator in the result:

  • {{convert|1,234,567|m|ft|comma=off}} → 1234567 metres (4050417 ft)*

Use |comma=gaps to set thousands grouping by gap (<space>):

  • {{convert|1234567|m|ft}} → 1,234,567 metres (4,050,417 ft) (To compare, default)
  • {{convert|1234567|m|ft|comma=gaps}}1234567 metres (4050417 ft)

Setting |comma=5 or |comma=gaps5 will only add the separator only when the number of digits is 5 or more:

  • {{convert|1234|m|ft}} → 1,234 metres (4,049 ft) (To compare, default)
  • {{convert|1234|m|ft|comma=5}} → 1234 metres (4049 ft)
  • {{convert|1234567|m|ft|comma=5}} → 1,234,567 metres (4,050,417 ft)
  • {{convert|1234|m|ft|comma=gaps5}}1234 metres (4049 ft)*
  • {{convert|1234567|m|ft|comma=gaps5}}1234567 metres (4050417 ft)*

In input, gaps are not accepted.

Fractions[edit]

An input value can be specified as a fraction.

  • {{convert|1/2|in|mm|1}}12 inch (12.7 mm)
  • {{convert|1/2|in|mm|1|adj=on}}12-inch (12.7 mm)
  • {{convert|2+1/2|in|mm|1}}2 12 inches (63.5 mm)
  • {{convert|-2-1/4|in|mm|1}}−2 14 inches (−57.2 mm)
  • {{convert|1/2|in|mm|1|spell=in}} → one-half inch (12.7 mm)

If two slashes are used, a horizontal fraction bar is used.

  • {{convert|1//2|in|mm|1}}1/2 inch (12.7 mm)
  • {{convert|2+1//2|in|mm|1}}2 1/2 inches (63.5 mm)

An output can be expressed with a fraction using |frac=N where N is the denominator. For example, |frac=8 rounds the output to the nearest eighth.

  • {{convert|219|mm|in|abbr=on}} → 219 mm (8.6 in)
  • {{convert|219|mm|in|abbr=on|frac=2}} → 219 mm (8 12 in)
  • {{convert|219|mm|in|abbr=on|frac=4}} → 219 mm (8 12 in)
  • {{convert|219|mm|in|abbr=on|frac=8}} → 219 mm (8 58 in)
  • {{convert|222|mm|in|abbr=on|frac=8}} → 222 mm (8 34 in)

A fraction is applied to the output unit (if there is only one), or to non-SI units (if using a combination), except that if a precision is also specified, the fraction only applies to the hand unit.

  • {{convert|18.45|in|m|frac=2}} → 18.45 inches (12 m)
  • {{convert|18.45|in|ft in hand cm|frac=2}} → 18.45 inches (1 12 ft; 18 12 in; 4.2 12 hands; 46.9 cm)
  • {{convert|18.45|in|ft in hand cm|frac=2|1}} → 18.45 inches (1.5 ft; 18.5 in; 4.2 12 hands; 46.9 cm)

Joins[edit]

The |disp= ("display") option may be used to "join" the input and output, as shown in the following examples.

Convert Output Description
{{convert|2.4|m|ft}} 2.4 metres (7.9 ft) default
{{convert|2.4|m|ft|disp=b}} 2.4 metres (7.9 ft) brackets (same as default)
{{convert|2.4|m|ft|disp=sqbr}} 2.4 metres [7.9 ft] square brackets
{{convert|2.4|m|ft|disp=or}} 2.4 metres or 7.9 feet or
{{convert|2.4|m|ft|disp=comma}} 2.4 metres, 7.9 ft comma
{{convert|2.4|m|ft|disp=br}} 2.4 metres
7.9 feet
"<br />", line break

Ranges[edit]

A range of values can be specified, as shown in the following examples.

Range separators in {{convert}}
Separator Convert Result Notes
- {{convert|3|-|6|ft}} 3–6 feet (0.91–1.83 m) Input can be hyphen (-) or en dash (–), output uses en dashes
- &ndash;(en dash) {{convert|3|–|6|ft}} 3–6 feet (0.91–1.83 m)
and {{convert|3|and|6|ft}} 3 and 6 feet (0.91 and 1.83 m)
and&& {{convert|3|&|6|ft}} 3 and 6 feet (0.91 and 1.83 m) Same as and
and(-) {{convert|3|and(-)|6|ft}} 3 and 6 feet (0.91–1.83 m) |abbr=on alters the punctuation
and(-)|abbr=on {{convert|3|and(-)|6|ft|abbr=on}} 3 and 6 ft (0.91–1.83 m)
or {{convert|3|or|6|ft}} 3 or 6 feet (0.91 or 1.83 m)
to {{convert|3|to|6|ft}} 3 to 6 feet (0.91 to 1.83 m)
to(-) {{convert|3|to(-)|6|ft}} 3 to 6 feet (0.91–1.83 m) |abbr=on alters the punctuation
to(-)|abbr=on {{convert|3|to(-)|6|ft|abbr=on}} 3 to 6 ft (0.91–1.83 m)
to about {{convert|3|to about|6|ft}} 3 to about 6 feet (0.91 to about 1.83 m)
+/- {{convert|3|+/-|6|ft}} 3 ± 6 feet (0.91 ± 1.83 m)
+/-± &plusmn; {{convert|3|±|6|ft}} 3 ± 6 feet (0.91 ± 1.83 m)
+ {{convert|3|+|6|ft}} 3 + 6 feet (0.91 + 1.83 m)
, {{convert|3|,|6|ft}} 3, 6 feet (0.91, 1.83 m)
, and {{convert|3|, and|6|ft}} 3, and 6 feet (0.91, and 1.83 m)
, or {{convert|3|, or|6|ft}} 3, or 6 feet (0.91, or 1.83 m)
by {{convert|3|by|6|ft}} 3 by 6 feet (0.91 by 1.83 m)
x {{convert|3|x|6|ft}} 3 by 6 feet (0.91 m × 1.83 m) Scientific notation.
|abbr=on alters the punctuation
× &times; {{convert|3|×|6|ft}} 3 by 6 feet (0.91 m × 1.83 m)
x|abbr=on {{convert|3|x|6|ft|abbr=on}} 3 ft × 6 ft (0.91 m × 1.83 m)
xx |xx| is deprecated. Use |x| instead
* |*| is deprecated. Use |x| instead
to- |to-| is deprecated. Use |to(-)| instead
& |&| is deprecated. Use |and| instead
abbr=mos |abbr=mos is deprecated. Use |x| or |by| instead


Ranges can use more than two values.

Convert Output
{{convert|3|x|4|x|24|in}} 3 by 4 by 24 inches (76 × 102 × 610 mm)
{{convert|3|x|4|to|6+1/2|x|8+3/4|in}} 3 by 4 to 6 12 by 8 34 inches (76 × 102 to 165 × 222 mm)

Ranges can be specified in the first parameter.

Convert Output
{{convert|3.2-7.5|ha}} 3.2–7.5 hectares (7.9–18.5 acres)
{{convert|3x4x24|in}} 3 by 4 by 24 inches (76 × 102 × 610 mm)

Extra words[edit]

Some options provide text that is included in the output, as shown in the following examples.

Convert Output Description
{{convert|4|ft||adj=mid|-long}} 4-foot-long (1.2 m) Adjectival with mid-text between input and output (sets |adj=on)
{{convert|40|acre||adj=pre|planted}} 40 planted acres (16 ha) Text before the input unit
{{convert|4|m||disp=preunit|+ }} 4+ metres (13+ ft) Same text before the input and output units
{{convert|4|m||disp=preunit|+ |or more }} 4+ metres (13 or more ft) Different text before the input and output units
{{convert|20|impfloz||disp=x|, approximately }} 20 imperial fluid ounces, approximately 570 ml; 19 US fl oz Text before the output (replaces the join)
{{convert|100|m||disp=x|/day (|/day)}} 100 metres/day (330 ft/day) Text before and after the output (replaces the join)

In each of the above examples, "||" provides an empty output unit which causes the default output to be used. An output unit, possibly empty, must be specified to avoid the template interpreting the extra text as the output unit. For example, using {{convert|4|ft|adj=mid|-long}} has the same effect as using {{convert|4|ft|-long|adj=mid}}, namely that an error would occur because "-long" would be used as the output unit. The following illustrates the error (hover the mouse over the error text to see that the problem is due to "-long" ) and how it may be avoided.

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

Displaying parts of a conversion[edit]

The following examples show how to display only some part of the output result.

Convert Output Description
{{convert|2|cuyd|m3}} 2 cubic yards (1.5 m3) normal convert
{{convert|2|cuyd|m3|abbr=values}} 2 (1.5) input and output values
{{convert|2|cuyd|m3|disp=unit}} cubic yards input unit
{{convert|2|cuyd|m3|disp=unit|adj=on}} cubic-yard input unit, adjectival (hyphenated)
{{convert|2|cuyd|cuyd|0|disp=out|abbr=off}} 2 cubic yards input (workaround)
{{convert|2|cuyd|m3|disp=unit2}} m3 output unit (symbol)
{{convert|2|cuyd|m3|disp=unit2|abbr=off}} cubic metres output unit (name)
{{convert|2|cuyd|m3|disp=number}} 1.5 output value
{{convert|2|cuyd|m3|disp=out}} 1.5 m3 output value and unit
{{convert|2|cuyd|m3|abbr=off|disp=out}} 1.5 cubic metres output value and unit

Flipping the order of output[edit]

To invert the order of measurements, simply use |order=flip

  • {{convert|10|km|mi}} → 10 kilometres (6.2 mi) (default)
  • {{convert|10|km|mi|order=flip}} → 6.2 miles (10 km)

Wrapping and line breaking[edit]

Convert uses the regular space (" ") and non-breaking space (&nbsp; which shows: " ") to control line-breaking (also called wrapping/nowrapping).

Wrapping is possible where a space (" ") is used. Prevent wrapping is enforced by using the non-breaking space, that ties and keeps text elements together.

3 feet may break after "3"
3&nbsp;ft, or 3_ft, will not break after "3"

In the examples below, an &nbsp; is shown as "_" (red underscore): "3_ft".

A line break (<br/>) forces a newline (line break), and so overrules any nowrap setting at that point.

Within a measurement (value+unit)

The separator between the value and the unit can be a space or a nonbreaking space (&nbsp;):

  • When a unit is abbreviated (symbol is shown), the separator is &nbsp;.
{{convert|12|m|ft|abbr=on}} → 12_m (39_ft)
  • When a unit is not abbreviated (name is shown), the separator is a space.
{{convert|12|m|ft}} → 12 metres (39_ft)
This can be set (overruled) to be &nbsp; by |adj=j (for 'join').
{{convert|12|m|ft|adj=j}} → 12_metres (39_ft)
  • Some units do not have a symbol and always use a space (such as acre).
{{convert|3|acre|m2|abbr=on}} → 3 acres (12,000_m2)
  • Except, option |adj=j ("join") forces the separator to be &nbsp;.
{{convert|3|acre|m2|adj=j}} → 3_acres (12,000_m2)
  • Except, &nbsp; is always used when a measurement is in multiple units.
{{convert|1|ft|6|in|cm}} → 1_foot 6_inches (46_cm)
{{convert|2|m|ftin}} → 2 metres (6_ft 7_in)
  • Except, if option |adj=on is used and the unit is not abbreviated, the separator is a hyphen ("-").
{{convert|2|m|ftin|adj=on}} → 2-metre (6_ft 7_in)
  • When the name of a number is used, &nbsp; is used as the separator between the value and the name. For example, a measurement spelled as "12 million metres" has &nbsp; before "million" and a space afterwards.
{{convert|12|e6m}} → 12_million metres (39,000,000_ft)
Between measurements
  • A space is used as the separator in a join between the first and second measurement.
{{convert|3|ft|m}} → 3 feet (0.91_m)
  • Except for the special case before "[" :
{{convert|12|in|cm|disp=sqbr|abbr=on}} → 12_in_[30_cm] (&nbsp; before "[")
  • Multiple output measurements (by listing units) always use a space between measurements ("; " has a space after ";").
{{convert|2|acre|m2 sqft ha}} → 2 acres (8,100_m2; 87,000_sq_ft; 0.81_ha)
Between components of a measurement (e.g., in a range; between foot–inch)
  • A measurement in multiple units always uses a space between components ("1 foot 6 inches" has &nbsp; before the unit names, but a space after "foot").
{{convert|1|ft|6|in|cm}} → 1_foot 6_inches (46_cm)
  • In a range, spaces are generally used to separate items. For example, "to" and "or" have a space before and after in the following.
{{convert|12|to|20|in|cm}} → 12 to 20 inches (30 to 51_cm)
{{convert|12|or|20|in|cm}} → 12 or 20 inches (30 or 51_cm)
  • The ranges +/- and , always use &nbsp;:
{{convert|12|+/-|2|in|cm}} → 12_±_2 inches (30.5_±_5.1_cm)
{{convert|12|,|20|in|cm}} → 12,_20 inches (30,_51_cm)
  • The "to-" range (same as "to(-)") is an exception. When a unit is not abbreviated, "to" has &nbsp; before and a space after.
{{convert|12|to-|20|in|cm}} → 12_to 20 inches (30–51_cm)
  • The "x" range is an exception. When a unit is abbreviated, "×" has a space before and &nbsp; after.
{{convert|12|x|20|in|cm}} → 12 by 20 inches (30_cm ×_51_cm)
Overrule by setting a line break
  • Parameter |disp=br adds a forced line break (<br/>) between measurements; brackets are omitted.
{{convert|12|m|ft|disp=br}} → 12 metres
39 feet
Preview wikicode

To see the wikicode result of the convert template: put your {{convert|...}} code into Special:ExpandTemplates and then preview by clicking OK.

Tables[edit]

The following parameters are intended for use in tables.

Parameter Description
|disp=table for a table cell with align="right"
|disp=tablecen for a table cell with align="center"
|sortable=on output a numeric hidden sort field for a sortable table

The following shows the wikitext output by some example converts.

Convert Resulting wikitext
{{convert|47.5|kg|lb}} 47.5 kilograms (105 lb)
{{convert|47.5|kg|lb|disp=table}} align="right"|47.5
|align="right"|105
{{convert|47.5|kg|lb|disp=tablecen}} align="center"|47.5
|align="center"|105
{{convert|47.5|kg|lb|sortable=on}} <span style="display:none">7001475000000000000</span>47.5 kilograms (105 lb)

Fixed table[edit]

This wikitext:

{|class="wikitable"
! align=right, rowspan="2" |
!colspan="2"| Length
!colspan="2"| Weight
|- style="vertical-align:bottom;"
!metres !!ft in !!kg !!lb
|-
! Lorem ipsum
| {{convert|28.1|m|ftin|disp=table}}
| {{convert|47.5|kg|lb|disp=table}}
|-
! Dolor sit amet
| {{convert|9.9|m|ftin|disp=table}}
| {{convert|74.1|kg|lb|disp=table}}
|-
! Consectetur
| {{convert|38.2|m|ftin|disp=table}}
| {{convert|31.5|kg|lb|disp=table}}
|-
! Adipisicing elit
| {{convert|18.7|m|ftin|disp=table}}
| {{convert|52.7|kg|lb|disp=table}}
|}

produces this table:

Length Weight
metres ft in kg lb
Lorem ipsum 28.1 92 ft 2 in 47.5 105
Dolor sit amet 9.9 32 ft 6 in 74.1 163
Consectetur 38.2 125 ft 4 in 31.5 69
Adipisicing elit 18.7 61 ft 4 in 52.7 116

Sortable table[edit]

This wikitext:

{|class="wikitable sortable"
! align=right, rowspan="2" |
!colspan="2"| Length
!colspan="2"| Weight
|- style="vertical-align:bottom;"
!metres !!ft in !!kg !!lb
|-
! Lorem ipsum
| {{convert|28.1|m|ftin|disp=table|sortable=on}}
| {{convert|47.5|kg|lb|disp=table|sortable=on}}
|-
! Dolor sit amet
| {{convert|9.9|m|ftin|disp=table|sortable=on}}
| {{convert|74.1|kg|lb|disp=table|sortable=on}}
|-
! Consectetur
| {{convert|38.2|m|ftin|disp=table|sortable=on}}
| {{convert|31.5|kg|lb|disp=table|sortable=on}}
|-
! Adipisicing elit
| {{convert|18.7|m|ftin|disp=table|sortable=on}}
| {{convert|52.7|kg|lb|disp=table|sortable=on}}
|}

produces this table:

Length Weight
metres ft in kg lb
Lorem ipsum 28.1 92 ft 2 in 47.5 105
Dolor sit amet 9.9 32 ft 6 in 74.1 163
Consectetur 38.2 125 ft 4 in 31.5 69
Adipisicing elit 18.7 61 ft 4 in 52.7 116

Units in singular or plural[edit]

Unit symbols are always singular. Unit names can be singular or plural. A unit is singular when the number is exactly +1:

  • {{convert|0.5|ft|m|abbr=off}} → 0.5 feet (0.15 metres)
  • {{convert|1|ft|m|abbr=off}} → 1 foot (0.30 metres)
  • {{convert|2|ft|m|abbr=off}} → 2 feet (0.61 metres)
Note: as of November 2014, in certain conditions this topic can behave unexpected (bug).

Setting |adj=1 makes these values singular: (−1 <= v and v < 0) or (0 < v and v <= 1)

  • {{convert|2|ft|m|adj=1|abbr=off}} → 2 feet (0.61 metre)
  • {{convert|1|ft|m|adj=1|abbr=off}} → 1 foot (0.30 metre)
  • {{convert|0.5|ft|m|adj=1|abbr=off}} → 0.5 foot (0.15 metre)
  • {{convert|0|ft|m|adj=1|abbr=off}} → 0 feet (0 metres)
  • {{convert|-0.5|ft|m|adj=1|abbr=off}} → −0.5 foot (−0.15 metre)
  • {{convert|-1|ft|m|adj=1|abbr=off}} → −1 foot (−0.30 metre)
  • {{convert|-2|ft|m|adj=1|abbr=off}} → −2 feet (−0.61 metre)

Parameter list[edit]

Parameter options for {{convert}}
Option =.. Description Note
|abbr=in in Use symbol for first (left-hand side) unit Symbol ('abbreviation')
|abbr=off off Use name for all units Symbol ('abbreviation')
|abbr=none none
|abbr=on on Use symbol for all units Symbol ('abbreviation')
|abbr=out out Use symbol for right-hand side unit (default) Symbol ('abbreviation')
|abbr=values values Show only input and output numbers, not units Parts only
|abbr=~ ~ Shows both unit name and symbol Symbol & name
|adj=j j Join number and unit name using "&nbsp;" instead of a space Join values
|adj=mid|x=... mid User-specified text after the input unit; sets adj=on (adjective) Word adding, adjective
|adj=on on Unit name is adjective (singular and hyphenated) Grammar, adjective
|adj=pre|x=... pre User-specified text before input unit Word adding
|adj=ri0 ri0 Round input with precision 0 Rounding and sigfig
|adj=ri1 ri1 Round input with precision 1 Rounding and sigfig
|adj=ri2 ri2 Round input with precision 2 Rounding and sigfig
|adj=ri3 ri3 Round input with precision 3 Rounding and sigfig
|disp=b b Join input and output using " (...)" (default) Join values
|disp=sqbr sqbr Join input and output using " [...]" Join values
|disp=br br Join input and output using "<br/>" Join values
|disp=comma comma Join input and output using ", " Join values
|disp=or or Join input and output using " or " Join values
|disp=number number Display output number only Parts only
|disp=output number only output number only
|disp=out out Display only output number and name/symbol Parts only
|disp=output only output only
|disp=preunit|x=... preunit User-specified text before input and output units Word adding
|disp=table table Output is suitable for a table cell with align="right" Table columns
|disp=tablecen tablecen Output is suitable for a table cell with align="center" Table columns
|disp=unit unit Display input name/symbol only ( not input number, not output) Parts only
|disp=unit2 unit2 Display output name/symbol only (not input; not output number) Parts only
|disp=x|... x Join input and output using user-specified text Word adding
|comma=5 05 Only use comma for thousands separator if 5 or more digits Number format
|comma=gaps gaps Use gaps (space), not comma, for thousands separator Number format
|comma=gaps5 gaps5 Use gaps (space), but only if 5 or more digits Number format
|comma=off off No thousands separator Number format
|frac=N N Show imperial number in fractions, denominator=N Number format, fraction
|lk=in in Link left-hand side unit name or symbol Unit link
|lk=on on Link all unit names or symbols (but not twice for the same unit) Unit link
|lk=out out Link right-hand side unit name or symbol Unit link
|order=flip flip Inverts order of input, output measurements (conversion first) Order
|round=5 05 Rounds calculation to the nearest multiple of 5 Rounding and sigfig
|round=25 25 Rounds calculation to the nearest multiple of 25 Rounding and sigfig
|round=each each In a range, each number is rounded by the default rounding Rounding and sigfig
|sigfig=N N Round output number to N significant figures (N is a positive integer) Rounding and sigfig
|sortable=in in Output numeric hidden sort field for use in a sortable table (based on input) Table sort
|sortable=on on
|sortable=out out Output numeric hidden sort field for use in a sortable table (based on output) Table sort
|sp=us us Use U.S. spelling (like "meter" instead of default "metre") Spelling U.S. names
|spell=in in Spell input number in words Spelling numbers
|spell=In In Spell input number in words with first letter uppercase Spelling numbers
|spell=on on Spell input and output numbers in words Spelling numbers
|spell=On On Spell input and output numbers in words with first letter uppercase Spelling numbers
|$= $ Replace $-sign with a currency sign, for example in $/acre (no currency conversion happens) Cost per unit
|debug=yes yes Debugging only. In a sortable table: show the normally hidden sort key Table sort
|abbr=comma comma Deprecated. Use |comma=off Number format
|abbr=mos mos Deprecated. Use |x| or |by| Range format
|adj=1 01 Deprecated. Do not use. No need to deviate from MOS regarding plurals Plural or singular
|adj=flip flip Deprecated. Use |order=flip Order
|adj=nocomma nocomma Deprecated. Use |comma=off Number format
|disp=2 02 Deprecated. Use |disp=output only Parts only
|disp=5 05 Deprecated. Use |round=5 Rounding and sigfig
|disp=flip flip Deprecated. Use |order=flip Order
|disp=flip5 flip5 Deprecated. Use |order=flip |round=5 Order, rounding
|disp=nocomma nocomma Deprecated. Use |comma=off Number format
|disp=u2 u2 Deprecated. Use |disp=unit2 Parts only
|near=5 05 Deprecated. Use |round=5 Rounding and sigfig

Complicated grammar[edit]

This example is from article Fort McHenry:

The American defenders had 18-, 24- and 32-pounder (8, 11 and 15 kg) cannons.

This result is not possible straightforward by using {{convert}}. However, it can be made in three steps. Short: step 1: get the values right using {{convert}}, step 2: make them into hardcoded text, step 3: edit text into correct spelling and grammar. Long:


Step 1: Enter the input numbers and units in {{convert}} just to get the calculated output:

  • had {{convert|18|,|24|,|32|lb|kg|0}} cannons
→ had 18, 24, 32 pounds (8, 11, 15 kg) cannons
The core conversion should look good now. You can save this (or preview).


Step 2: We need the resulting text in plain code in the page, not as a {{convert|...}} template.

For this, add subst: to the template name (for 'substitute') :
  • had {{subst:convert|18|,|24|,|32|lb|kg|0}} cannons
As a check: the preview result should show the conversion correct, with the values still right. Now save this.
→ had 18, 24, 32 pounds (8, 11, 15 kg) cannons


Step 3: When opening the edit screen again, you'll see that the text is there in code.

You can change the text as needed. The template {{convert|...}} itself has disappeared. The edit screen text is:
had 18,&nbsp;24,&nbsp;32 pounds (8,&nbsp;11,&nbsp;15&nbsp;kg) cannons
You can edit this text to add the grammar:
  • had 18-,_24-_and_32-pounder (8,&nbsp;11_and_15&nbsp;kg) cannons
After saving your edit, it shows:
→ "had 18-, 24- and 32-pounder (8, 11 and 15 kg) cannons".
  • Other options are (all replacing step 2 in the above):
B. Save the primary {{convert}} conversion, and then copy-paste the values from the plain read page into edit-page.
C. Put the {{convert|...}} code in Special:ExpandTemplates, and paste the result from there into the edit screen.

Differences from templates previously used[edit]

Before December 2013, {{convert}} was implemented by a series of templates, not a module. Following are some differences between the new and old convert implementations.

  • Using {{subst:convert|...}} works with the module.
  • The module checks unit types and displays an error message if a mismatch occurs.
  • Ranges and all options, including order=flip, work with all units.
  • Scaled units like e6USgal are not predefined. With some exceptions, all standard (simple) units accept prefixes e3, e6, e9, e12, e15.
  • The module uses an empty unit code rather than 0 to mean "use the default unit", as in {{convert|4|ft||abbr=on}}
Note that writing {{convert|4|ft|0|abbr=on}} sets the output precision to zero.
  • The functionality of {{convert/3}} and {{convert/4}} is handled by the module, except that the module does not support arbitrary text to separate items in a range. Furthermore, the predefined separator words such as "by" and "to" behave in exactly the same manner as they do for standard converts, so a conversion like {{convert/3|2|x|4|x|6|m|ft}} would need to use the new * separator rather than x to produce exactly the same output with the module.
  • The module does not have a problem with template loops, and will allow pointless conversions like {{convert|123|m|m}}.

Deprecated[edit]

This list: view · talk · edit

Deprecated options should not be used. They may produce incorrect or undesired results and there is no guarantee that they will be supported in the future.

  • abbr=comma is deprecated. Use comma=off instead
  • abbr=mos, setting range separators, is deprecated (not MOS compliant). Use |by| or |x| instead
  • adj=1 is deprecated. No need to deviate from MOS regarding plurals
  • adj=flip is deprecated. Use order=flip instead
  • adj=nocomma is deprecated. Use comma=off instead
  • disp=2 is deprecated. Use disp=output only instead
  • disp=5 is deprecated. Use round=5 instead
  • disp=flip is deprecated. Use order=flip instead
  • disp=flip5 is deprecated. Use |order=flip |round=5 instead
  • disp=nocomma is depreated. Use comma=off instead
  • disp=slash, disp=s, disp=/ are deprecated. Use disp=or instead
  • disp=u2 is deprecated. Use disp=unit2 instead
  • near=5 is deprecated. Use round=5 instead
  • Range separator |xx| is deprecated (not MOS compliant). Use |x| instead
  • Range separator |*| is deprecated (not MOS compliant). Use |x| instead
  • Range separator |&| is deprecated. Use |and| instead
  • Range separator |to-| is deprecated. Use |to(-)| instead

Limitations[edit]

This is a list of features that the module may be expected to support, but which will not work.

Composite units cannot be used in a range:

If an expression is wanted, it has to use {{#expr:...}}:

  • {{convert|3*12|ft|mm}} → 3×12 feet (910×3,660 mm)
  • {{convert|{{#expr:3*12}}|ft|mm}} → 36 feet (11,000 mm)