:Help:Convert

{{Wikipedia how-to|H:CON}}

Template {{tl|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. See the documentation at Template:Convert for further details.

Asking questions

Units

Quick start

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}} → {{convert|123.4|ft|m}}
  • {{convert|123.4|ft|m|abbr=on}} → {{convert|123.4|ft|m|abbr=on}}
  • {{convert|123.4|ft|m|abbr=off}} → {{convert|123.4|ft|m|abbr=off}}
  • {{convert|123.4|ft|m|abbr=off|sp=us}} → {{convert|123.4|ft|m|abbr=off|sp=us}}
  • {{convert|123.4|ft|m|0}} → {{convert|123.4|ft|m|0}}
  • {{convert|123.4|ft|m|3}} → {{convert|123.4|ft|m|3}}

Feet and inches can be converted, optionally with fractions.

  • {{convert|12.34|m|ft}} → {{convert|12.34|m|ft}}
  • {{convert|12.34|m|ftin}} → {{convert|12.34|m|ftin}}
  • {{convert|12.34|m|ftin|frac=4}} → {{convert|12.34|m|ftin|frac=4}}
  • {{convert|40|ft|6|in|m}} → {{convert|40|ft|6|in|m}}
  • {{convert|5+3/4|in|mm}} → {{convert|5+3/4|in|mm}}
  • {{convert|5+3/4|in|mm|0}} → {{convert|5+3/4|in|mm|0}}

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

  • {{convert|12300|m2|rood|abbr=off|lk=out}} → {{convert|12300|m2|rood|abbr=off|lk=out}}
  • {{convert|12.2|rood|m2|abbr=off|lk=in}} → {{convert|12.2|rood|m2|abbr=off|lk=in}}
  • {{convert|12300|m2|rood|abbr=off|lk=on}} → {{convert|12300|m2|rood|abbr=off|lk=on}}

A convert can be used in an adjectival phrase, and user-specified text can be inserted (e.g. -tall, -long, -high, -wide).

  • {{convert|1500|ft|m|adj=on}} → {{convert|1500|ft|m|adj=on}}
  • {{convert|1500|ft|m|adj=mid|-long}} → {{convert|1500|ft|m|adj=mid|-long}}

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

  • {{convert|123.4|ft}} → {{convert|123.4|ft}}
  • {{convert|123.4|ft|abbr=on}} → {{convert|123.4|ft|abbr=on}}
  • {{convert|1500|ft||adj=mid|-long}} → {{convert|1500|ft||adj=mid|-long}}

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.

  • {{convert|1500|ft|adj=mid|-long}} → {{convert|1500|ft|adj=mid|-long|test=nopreview}}

The input and output can be swapped ("flipped").

  • {{convert|12300|m2|rood|abbr=off|order=flip}} → {{convert|12300|m2|rood|abbr=off|order=flip}}

:In a flipped conversion, an option such as {{para|lk|out}} means "link the right-hand side".

:*{{convert|12300|m2|rood|abbr=off|lk=out|order=flip}} → {{convert|12300|m2|rood|abbr=off|lk=out|order=flip}}

:*{{convert|12300|m2|rood|abbr=off|lk=in|order=flip}} → {{convert|12300|m2|rood|abbr=off|lk=in|order=flip}}

:*{{convert|12300|m2|rood|abbr=off|lk=on|order=flip}} → {{convert|12300|m2|rood|abbr=off|lk=on|order=flip}}

The input value can be written out in words.

  • {{convert|5|mi|km|spell=in|0}} → {{convert|5|mi|km|spell=in|0}}
  • {{convert|5|mi|km|spell=In|0}} → {{convert|5|mi|km|spell=In|0}}

Ranges of values are supported.

  • {{convert|3|-|6|ft}} → {{convert|3|-|6|ft}}
  • {{convert|3|to|6|ft|abbr=off|sp=us}} → {{convert|3|to|6|ft|abbr=off|sp=us}}

A range can use more than two values.

  • {{convert|100|x|120|x|210|mm|in}} → {{convert|100|x|120|x|210|mm|in}}
  • {{convert|100|xx|120|xx|210|mm|in}} → {{convert|100|xx|120|xx|210|mm|in}}
  • {{convert|100|x|120|x|210|mm|in|abbr=on}} → {{convert|100|x|120|x|210|mm|in|abbr=on}}
  • {{convert|100|by|120|by|210|mm|in}} → {{convert|100|by|120|by|210|mm|in}}

Some input units consist of multiple components.

  • {{convert|5|ft|8|in}} → {{convert|5|ft|8|in}}
  • {{convert|11|st|3|lb|kg}} → {{convert|11|st|3|lb|kg}}

The output can show several different units.

  • {{convert|123|nmi|km mi}} → {{convert|123|nmi|km mi}}
  • {{convert|123|hPa|psi inHg|abbr=on|lk=on}} → {{convert|123|hPa|psi inHg|abbr=on|lk=on}}

When a unit such as short ton contains a space, use + to separate units.

  • {{convert|1,234|metric ton|short ton+long ton}} → {{convert|1,234|metric ton|short ton+long ton}}

Some outputs give a measurement in multiple units.

  • {{convert|123.4|m|ydftin}} → {{convert|123.4|m|ydftin}}
  • {{convert|123.4|kg|stlb}} → {{convert|123.4|kg|stlb}}

:Only output multiple codes such as ydftin can be used:

:*{{convert|123.4|m|yd ft in}} → {{convert|123.4|m|yd ft in}}

:*{{convert|123.4|m|yardfootinch}} → 123.4 m Error in convert: Unit name "yardfootinch" is not known

Rounding

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) displays N digits after the decimal mark (round output to N decimal places).
  • |-N (where -N is a negative number) replaces N digits before the decimal mark 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. The round value can be 0.5, 5, 10, 25 or 50.

Examples:

  • {{convert|1234|ft|m}} → {{convert|1234|ft|m}}
  • {{convert|1234|ft|m|2}} → {{convert|1234|ft|m|2}}
  • {{convert|1234|ft|m|-1}} → {{convert|1234|ft|m|-1}}
  • {{convert|1234|ft|m|round=5}} → {{convert|1234|ft|m|round=5}}
  • {{convert|1234|ft|m|round=10}} → {{convert|1234|ft|m|round=10}}
  • {{convert|1234|ft|m|round=25}} → {{convert|1234|ft|m|round=25}}
  • {{convert|1234|ft|m|round=50}} → {{convert|1234|ft|m|round=50}}
  • {{convert|1234|ft|m|sigfig=2}} → {{convert|1234|ft|m|sigfig=2}}
  • {{convert|1234|ft|m|sigfig=4}} → {{convert|1234|ft|m|sigfig=4}}
  • {{convert|1230|ft|m}} → {{convert|1230|ft|m}}
  • {{convert|1230|ft|m|0}} → {{convert|1230|ft|m|0}}
  • {{convert|1230|ft|m|1}} → {{convert|1230|ft|m|1}}
  • {{convert|5670|sqft}} → {{convert|5670|sqft}}
  • {{convert|5670|sqft|-2}} → {{convert|5670|sqft|-2}}
  • {{convert|7|x|8|x|12|ft|abbr=on|round=0.5}} → {{convert|7|x|8|x|12|ft|abbr=on|round=0.5}}

An input value such as 5000 is assumed to have one significant figure, while 5001 has four. If wanted, "5000." can be used to specify an input number that has four significant figures.

  • {{convert|5000|m}} → {{convert|5000|m}}
  • {{convert|5000.|m}} → {{convert|5000.|m}}

Spell

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

  • {{convert|6|km}} → {{convert|6|km}}
  • {{convert|6|km|sp=us}} → {{convert|6|km|sp=us}}

Using {{para|spell|us}} also works:

  • {{convert|6|km|spell=us}} → {{convert|6|km|spell=us}}

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

  • {{convert|5|mi|km|spell=in}} → {{convert|5|mi|km|spell=in}}
  • {{convert|5|mi|km|spell=in|abbr=off|0}} → {{convert|5|mi|km|spell=in|abbr=off|0}}
  • {{convert|5|mi|km|spell=In|0}} → {{convert|5|mi|km|spell=In|0}}
  • {{convert|5|mi|km|spell=In|abbr=off|0}} → {{convert|5|mi|km|spell=In|abbr=off|0}}
  • {{convert|2+1/4|mi|km|abbr=off|0|spell=In}} → {{convert|2+1/4|mi|km|abbr=off|0|spell=In}}
  • {{convert|2+1/4|mi|km|abbr=off|0|spell=In|sp=us}} → {{convert|2+1/4|mi|km|abbr=off|0|spell=In|sp=us}}

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

  • {{convert|5|mi|0|order=flip|spell=in}} → {{convert|5|mi|0|order=flip|spell=in}}
  • {{convert|5|mi|0|order=flip|spell=In|abbr=off}} → {{convert|5|mi|0|order=flip|spell=In|abbr=off}}

Both input and output values can be spelled:

  • {{convert|5|mi|m|-2|spell=on|sp=us|abbr=off}} → {{convert|5|mi|m|-2|spell=on|sp=us|abbr=off}}
  • {{convert|5|mi|m|-2|spell=On|sp=us|abbr=off}} → {{convert|5|mi|m|-2|spell=On|sp=us|abbr=off}}

Thousands separator

Commas in input numbers are ignored but spaces are not accepted: 1,000 is one thousand but 1 000 is an error.

In the output, the default thousands separator is a comma:

  • {{convert|1234567|m|ft}} → {{convert|1234567|m|ft}}
  • {{convert|1,234,567|m|ft}} → {{convert|1,234,567|m|ft}}

Set {{para|comma|off}} to remove separators from the result:

  • {{convert|1,234,567|m|ft|comma=off}} → {{convert|1,234,567|m|ft|comma=off}}

Setting {{para|comma|5}} adds a separator only when the number of digits is 5 or more:

  • {{convert|1234|m|ft}} → {{convert|1234|m|ft}}
  • {{convert|1234|m|ft|comma=5}} → {{convert|1234|m|ft|comma=5}}
  • {{convert|12345|m|ft|comma=5}} → {{convert|12345|m|ft|comma=5}}

Set {{para|comma|gaps}} to use a small space for thousands grouping. If the resulting number is copied, only the digits are copied (the gaps are omitted).

  • {{convert|1234567|m|ft}} → {{convert|1234567|m|ft}}
  • {{convert|1234567|m|ft|comma=gaps}} → {{convert|1234567|m|ft|comma=gaps}}

Gaps are inserted on both sides of the decimal mark. However, by default, no gap is inserted before a single digit. If a gap is always wanted, {{para|comma|gaps3}} can be used.

  • {{convert|1234.98765|m|ft|comma=gaps}} → {{convert|1234.98765|m|ft|comma=gaps}}
  • {{convert|1234.98765|m|ft|comma=gaps3}} → {{convert|1234.98765|m|ft|comma=gaps3}}
  • {{convert|1234.9876|m|ft|comma=gaps}} → {{convert|1234.9876|m|ft|comma=gaps}}
  • {{convert|1234.9876|m|ft|comma=gaps3}} → {{convert|1234.9876|m|ft|comma=gaps3}}
  • {{convert|1.2349876|m|ft|comma=gaps}} → {{convert|1.2349876|m|ft|comma=gaps}}
  • {{convert|1.2349876|m|ft|comma=gaps3}} → {{convert|1.2349876|m|ft|comma=gaps3}}

Fractions

An input value can be specified as a fraction.

  • {{convert|1/2|in|mm|1}} → {{convert|1/2|in|mm|1}}
  • {{convert|1/2|in|mm|1|adj=on}} → {{convert|1/2|in|mm|1|adj=on}}
  • {{convert|2+1/2|in|mm|1}} → {{convert|2+1/2|in|mm|1}}
  • {{convert|1|ft|10+5/8|in}} → {{convert|1|ft|10+5/8|in}}
  • {{convert|-2-1/4|in|mm|1}} → {{convert|-2-1/4|in|mm|1}}
  • {{convert|1/2|in|mm|1|spell=in}} → {{convert|1/2|in|mm|1|spell=in}}

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

  • {{convert|1//2|in|mm|1}} → {{convert|1//2|in|mm|1}}
  • {{convert|2+1//2|in|mm|1}} → {{convert|2+1//2|in|mm|1}}

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}} → {{convert|219|mm|in|abbr=on}}
  • {{convert|219|mm|in|abbr=on|frac=2}} → {{convert|219|mm|in|abbr=on|frac=2}}
  • {{convert|219|mm|in|abbr=on|frac=4}} → {{convert|219|mm|in|abbr=on|frac=4}}
  • {{convert|219|mm|in|abbr=on|frac=8}} → {{convert|219|mm|in|abbr=on|frac=8}}
  • {{convert|222|mm|in|abbr=on|frac=8}} → {{convert|222|mm|in|abbr=on|frac=8}}

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}} → {{convert|18.45|in|m|frac=2}}
  • {{convert|18.45|in|ft in hand cm|frac=2}} → {{convert|18.45|in|ft in hand cm|frac=2}}
  • {{convert|18.45|in|ft in hand cm|frac=2|1}} → {{convert|18.45|in|ft in hand cm|frac=2|1}}

If |frac=-N is used (negative N), a horizontal fraction bar is used for the output.

  • {{convert|12.7|mm|frac=-2}} → {{convert|12.7|mm|frac=-2}}
  • {{convert|222|mm|in|abbr=on|frac=-8}} → {{convert|222|mm|in|abbr=on|frac=-8}}

Joins

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

class="wikitable"

! Convert !! Output !! Description

{{convert|2.4|m|ft}}{{convert|2.4|m|ft}}default
{{convert|2.4|m|ft|disp=sqbr}}{{convert|2.4|m|ft|disp=sqbr}}square brackets
{{convert|2.4|m|ft|disp=or}}{{convert|2.4|m|ft|disp=or}}or
{{convert|2.4|m|ft|disp=comma}}{{convert|2.4|m|ft|disp=comma}}comma
{{convert|2.4|m|ft|disp=semicolon}}{{convert|2.4|m|ft|disp=semicolon}}semicolon
{{convert|2.4|m|ft|disp=br}}{{convert|2.4|m|ft|disp=br}}"<br />", line break
{{convert|2.4|m|ft|disp=br()}}{{convert|2.4|m|ft|disp=br()}}line break and brackets

Ranges

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

class="wikitable"
Separator

! Convert

! Result

! Notes

-

| {{convert|3

6|ft}}

| {{convert|3

6|ft}}

| rowspan=2 | Input can be hyphen (-) or en dash (–), output uses en dash

and

| {{convert|3|and|6|ft}}

| {{convert|3|and|6|ft}}

and(-)

| {{convert|3|and(-)|6|ft}}

| {{convert|3|and(-)|6|ft}}

| rowspan=2 | and on left; en dash on right

and(-)|order=flip

| {{convert|3|and(-)|6|ft|order=flip}}

| {{convert|3|and(-)|6|ft|order=flip}}

or

| {{convert|3|or|6|ft}}

| {{convert|3|or|6|ft}}

|

to

| {{convert|3|to|6|ft}}

| {{convert|3|to|6|ft}}

|

to(-)

| {{convert|3|to(-)|6|ft}}

| {{convert|3|to(-)|6|ft}}

| rowspan=2 | to on left; en dash on right

to(-)|order=flip

| {{convert|3|to(-)|6|ft|order=flip}}

| {{convert|3|to(-)|6|ft|order=flip}}

to about

| {{convert|3|to about|6|ft}}

| {{nowrap|{{convert|3|to about|6|ft}}}}

|

+/-

| {{convert|3|+/-|6|ft}}

| {{convert|3|+/-|6|ft}}

|

{{hidden sort key|1=+/-}}± &plusmn;

| {{convert|3|±|6|ft}}

| {{convert|3|±|6|ft}}

|

+

| {{convert|3|+|6|ft}}

| {{convert|3|+|6|ft}}

|

,

| {{convert|3|,|6|ft}}

| {{convert|3|,|6|ft}}

|

, and

| {{convert|3|, and|6|ft}}

| {{nowrap|{{convert|3|, and|6|ft}}}}

|

, or

| {{convert|3|, or|6|ft}}

| {{convert|3|, or|6|ft}}

|

/

| {{convert|83|/|63|F|disp=br()|abbr=values}}

| {{convert|83|/|63|F|disp=br()|abbr=values}}

| Slash with thin spaces for a table of high/low temperatures.

by

| {{convert|3|by|6|ft}}

| {{convert|3|by|6|ft}}

|

by(x)

| {{convert|3|by(x)|6|ft}}

| {{convert|3|by(x)|6|ft}}

| rowspan=2 | by on left; multiply (×) on right

by(x)|order=flip

| {{convert|3|by(x)|6|ft|order=flip}}

| {{convert|3|by(x)|6|ft|order=flip}}

x

| {{convert|3|x|6|ft}}

| {{convert|3|x|6|ft}}

x|abbr=on

| {{convert|3|x|6|ft|abbr=on}}

| {{convert|3|x|6|ft|abbr=on}}

| {{para|abbr|on}} displays × instead of by

xx

| {{convert|3|xx|6|ft|abbr=on}}

| {{convert|3|xx|6|ft|abbr=on}}

| Caution, see MOS:UNITNAMES.

Ranges can use more than two values.

class="wikitable"

! Convert !! Output

{{convert|3|x|4|x|24|in}}{{convert|3|x|4|x|24|in}}
{{convert|3|x|4|to|6+1/2|x|8+3/4|in}}{{convert|3|x|4|to|6+1/2|x|8+3/4|in}}
{{convert|3|xx|4|to|6+1/2|xx|8+3/4|in}}{{convert|3|xx|4|to|6+1/2|xx|8+3/4|in}}

Ranges can be specified in the first parameter although writing {{convert|3.2|-|7.5|ha}} would be clearer.

class="wikitable"

! Convert !! Output

{{convert|3.2-7.5|ha}}{{convert|3.2-7.5|ha}}
{{convert|3x4x24|in}}{{convert|3x4x24|in}}

Extra words

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

class="wikitable"

! Convert !! Output !! Description

{{convert|4|ftadj=mid
long}}{{convert|4|ftadj=mid
long}}

| Adjectival with mid-text between input and output {{nowrap|(sets {{para|adj|on}})}}

{{convert|40|acreadj=pre|planted}}{{convert|40|acreadj=pre|planted}}

| Text before the input unit

{{convert|4|mdisp=preunit|+ }}{{convert|4|mdisp=preunit|+ }}

| Same text before the input and output units

{{convert|4|mdisp=preunit|+ |or more }}{{convert|4|mdisp=preunit|+ |or more }}

| Different text before the input and output units

{{convert|20|impflozdisp=x|, approximately }}{{convert|20|impflozdisp=x|, approximately }}

| Text before the output (replaces the join)

{{convert|100|mdisp=x|/day (|/day)}}{{convert|100|mdisp=x|/day (|/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}} → {{convert|4|ft|adj=mid|-long|test=nopreview}}
  • {{convert|4|ft||adj=mid|-long}} → {{convert|4|ft||adj=mid|-long}}
  • {{convert|4|ft| |adj=mid|-long}} → {{convert|4|ft| |adj=mid|-long}}
  • {{convert|4|ft|m|adj=mid|-long}} → {{convert|4|ft|m|adj=mid|-long}}

Displaying "a" or "an" instead of "one"

{{tl|one2a}} may be used with {{tl|convert}}

  • {{convert|1|ft|spell=in}} → {{convert|1|ft|spell=in}}
  • {{one2a|{{convert|1|ft|spell=in}}}} → {{one2a|{{convert|1|ft|spell=in}}}}
  • {{one2a|{{convert|1|in|mm|1|spell=in}}}} → {{one2a|{{convert|1|in|mm|1|spell=in}}}}

Displaying parts of a conversion

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

:abbr=on (abbreviate) displays unit symbols, not names

class="wikitable"

! Convert !! Returns !! Components

{{convert|2|cuyd|m3}}{{convert|2|cuyd|m3}}all (default conversion)
{{convert|2|cuyd|m3{{bg|1=gold|2=|abbr=values}}}}{{convert|2|cuyd|m3|abbr=values}}numbers only
{{convert|2|cuyd|m3{{bg|1=gold|2=|disp=unit}}}}{{convert|2|cuyd|m3|disp=unit}}input unit
{{convert|2|cuyd|m3{{bg|1=gold|2=|disp=unit|adj=on}}}}{{convert|2|cuyd|m3|disp=unit|adj=on}}input unit, adjectival (hyphenated)
{{convert|2|cuyd|m3{{bg|1=gold|2=|disp=unit|adj=on|abbr=on}}}}{{convert|2|cuyd|m3|disp=unit|adj=on|abbr=on}}input unit, adjectival (but abbr so not hyphenated)
{{convert|2|cuyd{{bg|1=gold|2=|cuyd|disp=unit}}}}{{convert|2|cuyd|cuyd|disp=out}}input unit abbr (workaround)
{{convert|2|cuyd|m3{{bg|1=gold|2=|disp=out}}}}{{convert|2|cuyd|m3|disp=out}}output value, symbols
{{convert|2|cuyd|m3{{bg|1=gold|2=|disp=out|abbr=off}}}}{{convert|2|cuyd|m3|disp=out|abbr=off}}output value, names
{{convert|2|cuyd|m3{{bg|1=gold|2=|disp=out|adj=on|abbr=off}}}}{{convert|2|cuyd|m3|disp=out|adj=on|abbr=off}}output, adjective
{{convert|2|cuyd|m3{{bg|1=gold|2=|disp=number}}}}{{convert|2|cuyd|m3|disp=number}}output number
{{convert|2|cuyd|m3{{bg|1=gold|2=|disp=unit2}}}}{{convert|2|cuyd|m3|disp=unit2}}output unit (abbr by default)
{{convert|2|cuyd|m3{{bg|1=gold|2=|disp=unit2|abbr=off}}}}{{convert|2|cuyd|m3|disp=unit2|abbr=off}}output unit (name)
{{convert|2|cuyd|m3{{bg|1=gold|2=|disp=unit2|abbr=on}}}}{{convert|2|cuyd|m3|disp=unit2|abbr=on}}output unit (abbr)

Tables

The following parameters are intended for use in tables.

class="wikitable"

! Parameter !! Description

|disp=tablefor a table cell with align="right"
|disp=tablecenfor a table cell with align="center"
|sortable=onoutput a numeric hidden sort field for a sortable table

The following shows the wikitext output by some example converts.

class="wikitable"

! 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 =

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:

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}}

= Sortable table =

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:

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}}

Units in singular or plural

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}} → {{convert|0.5|ft|m|abbr=off}}
  • {{convert|1|ft|m|abbr=off}} → {{convert|1|ft|m|abbr=off}}
  • {{convert|2|ft|m|abbr=off}} → {{convert|2|ft|m|abbr=off}}

Parameter list

{{convert/doc/parameter list}}

Complicated grammar

This example is from article Fort McHenry:

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

This result cannot reasonably be produced by {{tlf|convert}}. However, convert can be used to construct the required text.

  • Use {{tlf|convert}} with subst to insert the required wikitext into the article or your sandbox.
  • :had {{subst:convert|18|,|24|,|32|lb|kg|0}} cannons
  • :→ had {{convert|18|,|24|,|32|lb|kg|0}} cannons
  • When the edit is saved, the convert template is replaced with the result.
  • Edit the result to produce the final text.
  • :→ had 18-, 24- and 32-pounder (8, 11 and 15 kg) cannons

An alternative to subst would be to enter {{convert|18|,|24|,|32|lb|kg|0}} into Special:ExpandTemplates, then copy and edit its result into the article.

Limitations

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:

  • {{convert|2|ft|6|in|to|3|ft|9|in}} → {{convert|2|ft|6|in|to|3|ft|9|in|test=nopreview}}

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

  • {{convert|3*12|ft|mm}} → {{convert|3*12|ft|mm}}
  • {{convert|{{#expr:3*12}}|ft|mm}} → {{convert|{{#expr:3*12}}|ft|mm}}

{{Convert/documentation navbox}}

{{Wikipedia help pages}}