Help:Convert
Lua error: Internal error: The interpreter exited with status 127.Lua error: Internal error: The interpreter exited with status 127. 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.
- Help:Convert units • Simplified list of some commonly used units
- Help:Convert messages • Error and warning messages
Asking questions
- Template talk:Convert • Questions on using the convert template, or discussion of any problems encountered, or proposals to add units or change convert
- Wikipedia:Help desk • General questions
- Module talk:Convert • Discussion concerning the convert modules (however, discussions relating to units should occur at Template talk:Convert)
Units
- Help:Convert units • Overview and simplified list of some commonly used units
- Module:Convert/documentation/conversion data • Full list of 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}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|123.4|ft|m|abbr=on}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|123.4|ft|m|abbr=off}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|123.4|ft|m|abbr=off|sp=us}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|123.4|ft|m|0}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|123.4|ft|m|3}}
→ Lua error: Internal error: The interpreter exited with status 127.
Feet and inches can be converted, optionally with fractions.
{{convert|12.34|m|ft}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|12.34|m|ftin}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|12.34|m|ftin|frac=4}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|40|ft|6|in|m}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|5+3/4|in|mm}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|5+3/4|in|mm|0}}
→ Lua error: Internal error: The interpreter exited with status 127.
To avoid overlinking, units are not normally linked, but they can be when needed.
{{convert|12300|m2|rood|abbr=off|lk=out}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|12.2|rood|m2|abbr=off|lk=in}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|12300|m2|rood|abbr=off|lk=on}}
→ Lua error: Internal error: The interpreter exited with status 127.
A convert can be used in an adjectival phrase, and user-specified text can be inserted.
{{convert|1500|ft|m|adj=on}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1500|ft|m|adj=mid|-long}}
→ Lua error: Internal error: The interpreter exited with status 127.
If no output unit is specified, a default is used.
{{convert|123.4|ft}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|123.4|ft|abbr=on}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1500|ft||adj=mid|-long}}
→ Lua error: Internal error: The interpreter exited with status 127.
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}}
→ Lua error: Internal error: The interpreter exited with status 127.
The input and output can be swapped ("flipped").
{{convert|12300|m2|rood|abbr=off|order=flip}}
→ Lua error: Internal error: The interpreter exited with status 127.
- In a flipped conversion, an option such as
|lk=out
means "link the right-hand side".{{convert|12300|m2|rood|abbr=off|lk=out|order=flip}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|12300|m2|rood|abbr=off|lk=in|order=flip}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|12300|m2|rood|abbr=off|lk=on|order=flip}}
→ Lua error: Internal error: The interpreter exited with status 127.
The input value can be written out in words.
{{convert|5|mi|km|spell=in|0}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|5|mi|km|spell=In|0}}
→ Lua error: Internal error: The interpreter exited with status 127.
Ranges of values are supported.
{{convert|3|-|6|ft}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|3|to|6|ft|abbr=off|sp=us}}
→ Lua error: Internal error: The interpreter exited with status 127.
A range can use more than two values.
{{convert|100|x|120|x|210|mm|in}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|100|x|120|x|210|mm|in|abbr=on}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|100|by|120|by|210|mm|in}}
→ Lua error: Internal error: The interpreter exited with status 127.
Some input units consist of multiple components.
{{convert|5|ft|8|in}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|11|st|3|lb|kg}}
→ Lua error: Internal error: The interpreter exited with status 127.
The output can show several different units.
{{convert|123|nmi|km mi}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|123|hPa|psi inHg|abbr=on|lk=on}}
→ Lua error: Internal error: The interpreter exited with status 127.
Some outputs give a measurement in multiple units.
{{convert|123.4|m|ydftin}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|123.4|kg|stlb}}
→ Lua error: Internal error: The interpreter exited with status 127.
- Only output multiple codes such as
ydftin
can be used:{{convert|123.4|m|yd ft in}}
→ Lua error: Internal error: The interpreter exited with status 127.{{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
(whereN
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
(whereN
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. Theround
value can be 0.5, 5, 10, 25 or 50.
Examples:
{{convert|1234|ft|m}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1234|ft|m|2}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1234|ft|m|-1}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1234|ft|m|round=5}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1234|ft|m|round=10}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1234|ft|m|round=25}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1234|ft|m|round=50}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1234|ft|m|sigfig=2}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1234|ft|m|sigfig=4}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1230|ft|m}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1230|ft|m|0}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1230|ft|m|1}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|5670|sqft}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|5670|sqft|-2}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|7|x|8|x|12|ft|abbr=on|round=0.5}}
→ Lua error: Internal error: The interpreter exited with status 127.
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}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|5000.|m}}
→ Lua error: Internal error: The interpreter exited with status 127.
Spell
Use |sp=us
to specify that unit names should be displayed with US spelling:
{{convert|6|km}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|6|km|sp=us}}
→ Lua error: Internal error: The interpreter exited with status 127.
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}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|5|mi|km|spell=in|abbr=off|0}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|5|mi|km|spell=In|0}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|5|mi|km|spell=In|abbr=off|0}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|2+1/4|mi|km|abbr=off|0|spell=In}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|2+1/4|mi|km|abbr=off|0|spell=In|sp=us}}
→ Lua error: Internal error: The interpreter exited with status 127.
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}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|5|mi|0|order=flip|spell=In|abbr=off}}
→ Lua error: Internal error: The interpreter exited with status 127.
Both input and output values can be spelled:
{{convert|5|mi|m|-2|spell=on|sp=us|abbr=off}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|5|mi|m|-2|spell=On|sp=us|abbr=off}}
→ Lua error: Internal error: The interpreter exited with status 127.
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 output, by default, the thousands separator is the comma:
{{convert|1234567|m|ft}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1,234,567|m|ft}}
→ Lua error: Internal error: The interpreter exited with status 127.
Set |comma=off
to remove separators from the result:
{{convert|1,234,567|m|ft|comma=off}}
→ Lua error: Internal error: The interpreter exited with status 127.
Setting |comma=5
adds a separator only when the number of digits is 5 or more:
{{convert|1234|m|ft}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1234|m|ft|comma=5}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|12345|m|ft|comma=5}}
→ Lua error: Internal error: The interpreter exited with status 127.
Set |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}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1234567|m|ft|comma=gaps}}
→ Lua error: Internal error: The interpreter exited with status 127.
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, |comma=gaps3
can be used.
{{convert|1234.98765|m|ft|comma=gaps}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1234.98765|m|ft|comma=gaps3}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1234.9876|m|ft|comma=gaps}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1234.9876|m|ft|comma=gaps3}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1.2349876|m|ft|comma=gaps}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1.2349876|m|ft|comma=gaps3}}
→ Lua error: Internal error: The interpreter exited with status 127.
Fractions
An input value can be specified as a fraction.
{{convert|1/2|in|mm|1}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1/2|in|mm|1|adj=on}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|2+1/2|in|mm|1}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1|ft|10+5/8|in}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|-2-1/4|in|mm|1}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1/2|in|mm|1|spell=in}}
→ Lua error: Internal error: The interpreter exited with status 127.
If two slashes are used, a horizontal fraction bar is used.
{{convert|1//2|in|mm|1}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|2+1//2|in|mm|1}}
→ Lua error: Internal error: The interpreter exited with status 127.
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}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|219|mm|in|abbr=on|frac=2}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|219|mm|in|abbr=on|frac=4}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|219|mm|in|abbr=on|frac=8}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|222|mm|in|abbr=on|frac=8}}
→ Lua error: Internal error: The interpreter exited with status 127.
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}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|18.45|in|ft in hand cm|frac=2}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|18.45|in|ft in hand cm|frac=2|1}}
→ Lua error: Internal error: The interpreter exited with status 127.
If |frac=-N
is used (negative N), a horizontal fraction bar is used for the output.
{{convert|12.7|mm|frac=-2}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|222|mm|in|abbr=on|frac=-8}}
→ Lua error: Internal error: The interpreter exited with status 127.
Joins
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}} |
Lua error: Internal error: The interpreter exited with status 127. | default |
{{convert|2.4|m|ft|disp=sqbr}} |
Lua error: Internal error: The interpreter exited with status 127. | square brackets |
{{convert|2.4|m|ft|disp=or}} |
Lua error: Internal error: The interpreter exited with status 127. | or |
{{convert|2.4|m|ft|disp=comma}} |
Lua error: Internal error: The interpreter exited with status 127. | comma |
{{convert|2.4|m|ft|disp=br}} |
Lua error: Internal error: The interpreter exited with status 127. | "<br />", line break |
{{convert|2.4|m|ft|disp=br()}} |
Lua error: Internal error: The interpreter exited with status 127. | line break and brackets |
Ranges
A range of values can be specified, as shown in the following examples.
Separator | Convert | Result | Notes |
---|---|---|---|
-
|
{{convert|3|-|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | Input can be hyphen (-) or en dash (–), output uses en dash |
and
|
{{convert|3|and|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
and(-)
|
{{convert|3|and(-)|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | and on left; en dash on right |
and(-)|order=flip
|
{{convert|3|and(-)|6|ft|order=flip}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
or
|
{{convert|3|or|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
to
|
{{convert|3|to|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
to(-)
|
{{convert|3|to(-)|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | to on left; en dash on right |
to(-)|order=flip
|
{{convert|3|to(-)|6|ft|order=flip}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
to about
|
{{convert|3|to about|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
+/-
|
{{convert|3|+/-|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
<span data-sort-value="Lua error: Internal error: The interpreter exited with status 127." style="display:none;">± ±
|
{{convert|3|±|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
+
|
{{convert|3|+|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
,
|
{{convert|3|,|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
, and
|
{{convert|3|, and|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
, or
|
{{convert|3|, or|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
/
|
{{convert|83|/|63|F|disp=br()|abbr=values}}
|
Lua error: Internal error: The interpreter exited with status 127. | Slash with thin spaces for a table of high/low temperatures. |
by
|
{{convert|3|by|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
by(x)
|
{{convert|3|by(x)|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | by on left; multiply (×) on right |
by(x)|order=flip
|
{{convert|3|by(x)|6|ft|order=flip}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
x
|
{{convert|3|x|6|ft}}
|
Lua error: Internal error: The interpreter exited with status 127. | Scientific notation.|abbr=on alters the punctuation
|
x|abbr=on
|
{{convert|3|x|6|ft|abbr=on}}
|
Lua error: Internal error: The interpreter exited with status 127. | |
xx
|
|xx| is deprecated. Use |x| instead | ||
*
|
|*| is deprecated. Use |x| instead |
Ranges can use more than two values.
Convert | Output |
---|---|
{{convert|3|x|4|x|24|in}} |
Lua error: Internal error: The interpreter exited with status 127. |
{{convert|3|x|4|to|6+1/2|x|8+3/4|in}} |
Lua error: Internal error: The interpreter exited with status 127. |
Ranges can be specified in the first parameter although writing {{convert|3.2|-|7.5|ha}}
would be clearer.
Convert | Output |
---|---|
{{convert|3.2-7.5|ha}} |
Lua error: Internal error: The interpreter exited with status 127. |
{{convert|3x4x24|in}} |
Lua error: Internal error: The interpreter exited with status 127. |
Extra words
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}} |
Lua error: Internal error: The interpreter exited with status 127. | adj=on) |
{{convert|40|acre||adj=pre|planted}} |
Lua error: Internal error: The interpreter exited with status 127. | Text before the input unit |
{{convert|4|m||disp=preunit|+ }} |
Lua error: Internal error: The interpreter exited with status 127. | Same text before the input and output units |
{{convert|4|m||disp=preunit|+ |or more }} |
Lua error: Internal error: The interpreter exited with status 127. | Different text before the input and output units |
{{convert|20|impfloz||disp=x|, approximately }} |
Lua error: Internal error: The interpreter exited with status 127. | Text before the output (replaces the join) |
{{convert|100|m||disp=x|/day (|/day)}} |
Lua error: Internal error: The interpreter exited with status 127. | 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}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|4|ft||adj=mid|-long}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|4|ft| |adj=mid|-long}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|4|ft|m|adj=mid|-long}}
→ Lua error: Internal error: The interpreter exited with status 127.
Displaying parts of a conversion
The following examples show how to display only a part of the result.
Convert | Output | Description |
---|---|---|
{{convert|2|cuyd|m3}} |
Lua error: Internal error: The interpreter exited with status 127. | normal convert |
{{convert|2|cuyd|m3|abbr=values}} |
Lua error: Internal error: The interpreter exited with status 127. | input and output values |
{{convert|2|cuyd|m3|disp=unit}} |
Lua error: Internal error: The interpreter exited with status 127. | input unit |
{{convert|2|cuyd|m3|disp=unit|adj=on}} |
Lua error: Internal error: The interpreter exited with status 127. | input unit, adjectival (hyphenated) |
{{convert|2|cuyd|cuyd|disp=out}} |
Lua error: Internal error: The interpreter exited with status 127. | input (workaround: repeat unit) |
{{convert|2|cuyd|m3|disp=unit2}} |
Lua error: Internal error: The interpreter exited with status 127. | output unit (symbol) |
{{convert|2|cuyd|m3|disp=unit2|abbr=off}} |
Lua error: Internal error: The interpreter exited with status 127. | output unit (name) |
{{convert|2|cuyd|m3|disp=number}} |
Lua error: Internal error: The interpreter exited with status 127. | output value |
{{convert|2|cuyd|m3|disp=out}} |
Lua error: Internal error: The interpreter exited with status 127. | output value and unit |
{{convert|2|cuyd|m3|abbr=off|disp=out}} |
Lua error: Internal error: The interpreter exited with status 127. | output value and unit |
Flipping the order of output
To invert the order of measurements, use |order=flip
{{convert|10|km|mi}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|10|km|mi|order=flip}}
→ Lua error: Internal error: The interpreter exited with status 127.
Wrapping and line breaking
Convert uses the regular space (" ") and non-breaking space (
which displays as " ") to control line-breaking (also called wrapping/nowrapping).
- In all examples below, an
is shown as "_" (red underscore): "3_ft
".
Wrapping is possible where a regular space (" ") is used. Prevent wrapping is enforced in the template using the non-breaking space, that ties and keeps text elements together.
3 feet
may break after "3"3 ft
, or Lua error: Internal error: The interpreter exited with status 127., will not break after "3"- A line break (<br/>) forces a newline (line break), and so overrules any nowrap setting at that point.
Word meaning:
- In measurements, SI uses wording that says that value = number × unit, for example length = number × meter.
- In Lua error: Internal error: The interpreter exited with status 127. documentation, sometimes 'value' is used to mean the number; and abbr is used to mean unit symbol(s).
- Within a single measured value (number and unit)
The separator between the number and the unit can be a space or a nonbreaking space (
):
- When a unit is abbreviated (symbol is shown), the separator is
.
{{convert|12|m|ft|abbr=on}}
→ Lua error: Internal error: The interpreter exited with status 127.
- When a unit is not abbreviated (name is shown), the separator is a space.
{{convert|12|m|ft}}
→ Lua error: Internal error: The interpreter exited with status 127.
- Some units do not have a symbol and always use a space (such as acre).
{{convert|3|acre|m2|abbr=on}}
→ Lua error: Internal error: The interpreter exited with status 127.
- Except,
is always used when a measurement is in multiple units.
{{convert|1|ft|6|in|cm}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|2|m|ftin}}
→ Lua error: Internal error: The interpreter exited with status 127.
- Except, if option
|adj=on
is used and the unit is not abbreviated, the separator is a hyphen ("-").
{{convert|2|m|ftin|adj=on}}
→ Lua error: Internal error: The interpreter exited with status 127.
- When the name of a number is used,
is used as the separator between the number and the name. For example, a measurement spelled as "12 million metres" has
before "million" and a space afterwards.
{{convert|12|e6m}}
→ Lua error: Internal error: The interpreter exited with status 127.
- Between measurements
- A space is used as the separator in a join between the first and second measurement.
{{convert|3|ft|m}}
→ Lua error: Internal error: The interpreter exited with status 127.
- Except for the special case before "[" :
{{convert|12|in|cm|disp=sqbr|abbr=on}}
→ Lua error: Internal error: The interpreter exited with status 127. (
before "[")
- Multiple output measurements (by listing units) always use a space between measurements ("; " has a space after ";").
{{convert|2|acre|m2 sqft ha}}
→ Lua error: Internal error: The interpreter exited with status 127.
- 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
before the unit names, but a space after "foot").
{{convert|1|ft|6|in|cm}}
→ Lua error: Internal error: The interpreter exited with status 127.
- 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}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|12|or|20|in|cm}}
→ Lua error: Internal error: The interpreter exited with status 127.
- The ranges
+/-
and,
always use
:
{{convert|12|+/-|2|in|cm}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|12|,|20|in|cm}}
→ Lua error: Internal error: The interpreter exited with status 127.
- The "to(-)" range is an exception. When a unit is not abbreviated, "to" has
before and a space after.
{{convert|12|to(-)|20|in|cm}}
→ Lua error: Internal error: The interpreter exited with status 127.
- The "x" range is an exception. When a unit is abbreviated, "×" has a space before and
after.
{{convert|12|x|20|in|cm}}
→ Lua error: Internal error: The interpreter exited with status 127.
- Overrule by setting a line break
- Parameter
|disp=br
adds a forced line break (<br/>
) between measurements; brackets are omitted. Use|disp=br()
to add the line break and keep the brackets.
{{convert|12|m|ft|disp=br}}
→ 12 metres<br/>39 feet shows:- Lua error: Internal error: The interpreter exited with status 127.
{{convert|12|m|ft|disp=br()}}
→ 12 metres<br/>(39 feet) shows:- Lua error: Internal error: The interpreter exited with status 127.
- Preview wikicode
To see the wikicode result of the convert template: put your {{convert|...}}
code into Special:ExpandTemplates and then preview by clicking Lua error: Internal error: The interpreter exited with status 127..
Tables
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}} |
47.5 |align="right"|105 |
{{convert|47.5|kg|lb|disp=tablecen}} |
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:
Length | Weight | |||
---|---|---|---|---|
metres | ft in | kg | lb | |
Lorem ipsum | Lua error: Internal error: The interpreter exited with status 127. | Lua error: Internal error: The interpreter exited with status 127. | ||
Dolor sit amet | Lua error: Internal error: The interpreter exited with status 127. | Lua error: Internal error: The interpreter exited with status 127. | ||
Consectetur | Lua error: Internal error: The interpreter exited with status 127. | Lua error: Internal error: The interpreter exited with status 127. | ||
Adipisicing elit | Lua error: Internal error: The interpreter exited with status 127. | Lua error: Internal error: The interpreter exited with status 127. |
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:
Length | Weight | |||
---|---|---|---|---|
metres | ft in | kg | lb | |
Lorem ipsum | Lua error: Internal error: The interpreter exited with status 127. | Lua error: Internal error: The interpreter exited with status 127. | ||
Dolor sit amet | Lua error: Internal error: The interpreter exited with status 127. | Lua error: Internal error: The interpreter exited with status 127. | ||
Consectetur | Lua error: Internal error: The interpreter exited with status 127. | Lua error: Internal error: The interpreter exited with status 127. | ||
Adipisicing elit | Lua error: Internal error: The interpreter exited with status 127. | Lua error: Internal error: The interpreter exited with status 127. |
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}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|1|ft|m|abbr=off}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|2|ft|m|abbr=off}}
→ Lua error: Internal error: The interpreter exited with status 127.
Parameter list
Lua error: Internal error: The interpreter exited with status 127. | |||
---|---|---|---|
Parameter | Value | Description | Note |
abbr=in | in
|
Use symbol for first (left-hand side) unit | Unit display |
abbr=off | off
|
Use name for all units | Unit display |
abbr=none | none
| ||
abbr=on | on
|
Use symbol for all units | Unit display |
abbr=out | out
|
Use symbol for right-hand side unit (default) | Unit display |
abbr=unit | unit
|
Use symbol for all units when using scientific notation | Unit display |
abbr=values | values
|
Omit both the input and output units: show only the numbers | Unit display |
abbr=~ | ~
|
Shows both unit name and symbol | Unit display |
adj=mid|… | mid
|
User-specified text after the input unit; sets adj=on (adjective). Expects 1 unnamed parameter.
|
Word adding, adjective |
adj=on | on
|
Unit name is adjective (singular and hyphenated) | Grammar, adjective |
adj=pre|… | pre
|
User-specified text before input unit. Expects 1 unnamed parameter. | Word adding |
adj=ri0 | ri0
|
Round input with precision 0 | Input precision |
adj=ri1 | ri1
|
Round input with precision 1 | Input precision |
adj=ri2 | ri2
|
Round input with precision 2 | Input precision |
adj=ri3 | ri3
|
Round input with precision 3 | Input precision |
comma=5 | 5
|
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=off | off
|
No thousands separator | Number format |
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|…[|…] | preunit
|
Text to be inserted after value and before units, for both input and output, with optionally different text for output. Expects 1 or 2 unnamed parameters. | 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 |
frac=N | N
|
Show imperial number in fractions, denominator=N | Number format, fraction |
input=P2048 | P2048 (e.g.)
|
Reads and converts Wikidata property | Inside template |
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 |
order=out | out
|
Displays output units in the order entered, skipping input unit | Order |
qid=Q1056131 | Q1056131 (e.g.)
|
Reads Wikidata property from Wikidata item | Inside template; testing |
qual=Q613628 | Q613628 (e.g.)
|
Qualify Wikidata property | |
round=5 | 5
|
Rounds calculation to the nearest multiple of 5 | Output precision |
round=25 | 25
|
Rounds calculation to the nearest multiple of 25 | Output precision |
round=each | each
|
In a range, each number is rounded by the default rounding | Output precision |
sigfig=N | N
|
Round output number to N significant figures (N is a positive integer) | Output precision |
sortable=on | on
|
Adds invisible sort key | Table sort |
sp=us | us
|
Use U.S. spelling ("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 €/hectare
|
Cost per unit No currency conversion happens |
debug=yes | yes
|
Debugging only. In a sortable table: show the normally hidden sort key | Table sort |
disp=flip | flip
|
Deprecated. Use |order=flip | Order |
sing= | Deprecated. Use |adj= | Plurals |
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 Lua error: Internal error: The interpreter exited with status 127.. However, convert can be used to construct the required text.
- Use Lua error: Internal error: The interpreter exited with status 127. with subst to insert the required wikitext into the article or your sandbox.
had {{subst:convert|18|,|24|,|32|lb|kg|0}} cannons
- → had Lua error: Internal error: The interpreter exited with status 127. 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.
Deprecated
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.
- disp=flip is deprecated. Use order=flip instead
- sing= is deprecated in any situation. Use adj= instead
- Range separator |xx| is deprecated (not compliant). Use |x| instead
- Range separator |*| is deprecated (not compliant). Use |x| instead
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}}
→ Lua error: Internal error: The interpreter exited with status 127.
If an expression is wanted, it has to use {{#expr:...}}
:
{{convert|3*12|ft|mm}}
→ Lua error: Internal error: The interpreter exited with status 127.{{convert|{{#expr:3*12}}|ft|mm}}
→ Lua error: Internal error: The interpreter exited with status 127.
Lua error: Internal error: The interpreter exited with status 127. Lua error: Internal error: The interpreter exited with status 127.