Template:Convert/doc

From The Crowdsourced Resource-Based Economy Knowledgebase
Jump to: navigation, search


Script error Script error Template {{convert}} calculates measurements from one unit (you can enter) to another one, and then presents the results. For example:

{{convert|2|km|mi}}Script error
{{convert|7|mi|km}}Script error

The available units are listed below. Units are case-sensitive always (kW, not KW and not kw). Multiple formatting and calculation options are listed below.

Script error

Contents

[edit] Unit name or symbol (abbreviation): 1 pound or 1 lb?

By default, the first value shows unit name, the second the symbols (= abbreviation). Use |abbr=on/off to change this behaviour:

{{convert|1|lb|kg}}Script error (To compare; default: first value shows unit name)
{{convert|1|lb|kg|abbr=on}}Script error
{{convert|1|lb|kg|abbr=off}}Script error
  • |abbr=in toggles the default behaviour (|abbr=out):
{{convert|1|lb|kg|abbr=in}}Script error

[edit] Adjective: a 10-mile distance

Use |adj=on to produce the adjective form. The difference:

{{convert|10|mi|km}} to goScript error to go. (To compare, default)
A {{convert|10|mi|km|adj=on}} distance → A Script error distance. (Adjective form)

[edit] Rounding: 100 ft is 30 m or 30.5 m or 30.48 m?

By definition, 100 ft equals Script error. In practical use, it is common to round the calculated metric number. With that, there are several possibilities.

[edit] Default rounding

By default, the conversion result will be rounded either to precision comparable to that of the input value (the number of digits after the decimal point—or the negative of the number of non-significant zeroes before the point—is increased by one if the conversion is a multiplication by a number between 0.02 and 0.2, remains the same if the factor is between 0.2 and 2, is decreased by 1 if it is between 2 and 20, and so on) or to two significant figures, whichever is more precise. An exception to this is rounding temperatures (see below).
Examples of rounding
Input Displays as Note
{{convert|123|ft|m|-1}} Script error
{{convert|123|ft|m|0}} Script error
{{convert|123|ft|m|1}} Script error
{{convert|550|ft|m|0}} Script error Approximate value is 167.64 m
{{convert|550|ft|m}} Script error Rounds to 170, when approximate value is 167.64 m
{{convert|500|ft|m|0}} Script error Approximate value is 152.4 m
{{convert|500|ft|m}} Script error Rounds to 150, when approximate value is 152.4 m

Convert supports four types of rounding:

[edit] Round to a given precision: use |precision=

Specify the desired precision with the fourth unnamed parameter (or third unnamed parameter if the "convert to" parameter is omitted; or fifth unnamed parameter if a range is specified; or fourth unnamed parameter again if a range is specified and the "convert to" parameter is omitted; needs to be replaced with a "precision" named parameter). The conversion is rounded off to the nearest power of 110 this number. For instance, if the result is 8621 and the round number is "-2", the result will be 8600. If the result is "234.0283043" and the round number is "0", the result will be 234.

[edit] Round to a given number of significant figures: use |sigfig=

To specify the output number to be with n significant figures use |sigfig=<number>:

  • To compare: {{convert|1200|ft|m}} → Script error
  • {{convert|1200|ft|m|sigfig=4}} → Script error
  • {{convert|1200|ft|m|sigfig=3}} → Script error
  • {{convert|1200|ft|m|sigfig=2}} → Script error
  • {{convert|1200|ft|m|sigfig=1}} → Script error

Setting |sigfig= is meaningless

  • {{convert|1200|ft|m|sigfig=0}} → Script error

[edit] Round to a multiple of 5: 15, 20, 25, ...

Using |round=5 rounds the outcome to a multiple of 5.

{{convert|10|m|ft}}Script error
{{convert|10|m|ft|round=5}}Script error

Similar: using |round=25 rounds the outcome to a multiple of 25.

{{convert|10|m|ft}}Script error
{{convert|10|m|ft|round=25}}Script error
To compare: {{convert|10|m|ft|sigfig=4}}Script error

In a range, one can round each value individually to the default. Use |round=each:

{{convert|10 x 200 x 3000|m|ft}}Script error
{{convert|10 x 200 x 3000|m|ft|round=each}}Script error

[edit] Round to a multiple of a given fraction: 2 316 inch

Specify the desired denominator using |frac=<some positive integer>. (Denominator is the below-the-slash number, for example the 3 in 13).

{{convert|5.56|cm|in|frac=16}}Script error
{{convert|8|cm|in|frac=4}}Script error

The fraction is reduced when possible:

{{convert|8|cm|in|frac=100}}Script error
{{convert|8|cm|in}}Script error (To compare)

[edit] Script errorRounding the temperatures °C, °F and K

In temperatures, the conversion will be rounded either to precision comparable to that of the input value or to that which would give three significant figures when expressed in kelvins, whichever is more precise.

{{convert|10|C|F K}}Script error

Note

For a temperature difference, like to convert "A rise of 10 °C", use |C-change=10 &tc.
{{convert|10|C-change|F-change K-change}} → A rise of Script error

[edit] Into multiple units: Script error

Separate the multiple output units by a space:

{{convert|10|C|F K}}Script error
{{convert|5|km|mi nmi}}Script error

[edit] Ranges of values

[edit] A range: 6 to 17 kg (13 to 37 lb)

Range indicators are entered as the second parameter (between the values). Range separators can be:

Range separators in {{convert}}
Separator Convert Result Notes
- {{convert|3|-|6|ft}} Script error Input can be hyphen (-) or en dash (–), output uses en dashes
- &ndash;(en dash) {{convert|3|–|6|ft}} Script error
and {{convert|3|and|6|ft}} Script error
and&& {{convert|3|&|6|ft}} Script error Same as and
and(-) {{convert|3|and(-)|6|ft}} Script error |abbr=on alters the punctuation
and(-)|abbr=on {{convert|3|and(-)|6|ft|abbr=on}} Script error
or {{convert|3|or|6|ft}} Script error
to {{convert|3|to|6|ft}} Script error
to(-) {{convert|3|to(-)|6|ft}} Script error |abbr=on alters the punctuation
to(-)|abbr=on {{convert|3|to(-)|6|ft|abbr=on}} Script error
to about {{convert|3|to about|6|ft}} Script error
+/- {{convert|3|+/-|6|ft}} Script error
+/-± &plusmn; {{convert|3|±|6|ft}} Script error
+ {{convert|3|+|6|ft}} Script error
, {{convert|3|,|6|ft}} Script error
, and {{convert|3|, and|6|ft}} Script error
, or {{convert|3|, or|6|ft}} Script error
by {{convert|3|by|6|ft}} Script error
x {{convert|3|x|6|ft}} Script error Scientific notation.
|abbr=on alters the punctuation
× &times; {{convert|3|×|6|ft}} Script error
x|abbr=on {{convert|3|x|6|ft|abbr=on}} Script error
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


[edit] Multiple dimensions: Script error

Use "by"
{{convert|6|by|12|ft|m}}Script error
Use "×" or ""x""
{{convert|6|x|12|m|ft}}Script error

In science, the formal way is to set |x| and |abbr=on (keeping dimensions right, like in area = x km2):

{{convert|6|x|12|m|ft|abbr=on}}Script error

[edit] About feet, inch in ranges and multiples

While it is possible to enter feet, inch in a simple conversion, this is not possible for ranges:

  • {{convert|1|ft|3|in|mm}}Script error (to compare)
  • {{convert|1|ft|3|in|x|3|ft|5|in|mm}}Script error

[edit] Words

[edit] Spelling of unit name: UK metre or US meter?

Default spelling of units is en-UK. To show en-US spelling, use |sp=us:

{{convert|1|m|ft}}Script error -- default
{{convert|1|m|ft|sp=us}}Script error

[edit] Spell out numbers: ten miles

To write a number in words, use |spell=in:

{{convert|10|mi|m|spell=in}}Script error

To spell out both in and out values, use |spell=on:

{{convert|10|mi|m|spell=on}}Script error

To make first letter a capital, use |spell=In, |spell=On

{{convert|10|mi|m|spell=In}}Script error
{{convert|10|mi|m|spell=On}}Script error

Remember that the spelling of the units (ft, m) is independently set by |abbr=. To the extreme:

{{convert|10|mi|m|spell=on|abbr=off|sp=us}}Script error

[edit] Extra words: 4 planted acres

Incomplete section
{{convert|4|acre||adj=pre|planted}}Script error

[edit] Extra adjective words: A Script error corridor

{{convert|4|ft|m|adj=mid|-long}}Script error

[edit] Plurals: 1 inch, 2 inches

The unit symbol is singular always. Depending on the preceding number only, a unit name can be shown plural.

  • {{convert|1|metre}}Script error
  • {{convert|2|metre}}Script error
  • {{convert|2|metre|abbr=on}}Script error
Exception

Entering the unit spelled |foot| forces singular output "foot", whatever the number is.

  • {{convert|100|foot|abbr=off}}Script error

[edit] Grammatical construction: The 18-, 24- and 32-pounder (8, 11 and 15 kg) cannons

This example is from article Fort McHenry:

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

This formatted result is not possible straightforward by using {{convert}}. However, it can be made in three steps.

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 Script error 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:<code> to the template name (for 'substitute') :
  • <code>had {{subst:convert|18 |, |24 |, |32 |lb |kg |0 }} cannons
As a check: the preview result should show the conversion correct, with the numbers 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. The template {{convert|...}} itself has disappeared. You can change the text as needed. 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".

[edit] Numbers

[edit] Using an SI prefix: gigameter (Gm), or micrometer (μm)

Metric prefixes
Text Symbol Factor
yotta Y 1024
zetta Z 1021
exa E 1018
peta P 1015
tera T 1012
giga G 109
mega M 106
kilo k 103
hecto h 102
deca da 101
(none) (none)  1
deci d 10−1
centi c 10−2
milli m 10−3
micro μ 10−6
nano n 10−9
pico p 10−12
femto f 10−15
atto a 10−18
zepto z 10−21
yocto y 10−24

Units can have an SI prefix like G before the unit: Gm, and giga before the name: gigameter. These are plain multiplication factors.

To illustrate, these are trivial calculations (from meter to meter), showing the multiplication factor:

  • Script error
  • Script error

The prefix can be added before the SI unit (here: unit m for meter):

  • {{convert|12|Gm|mi|abbr=on}}Script error
  • Mm: Script error
  • km: Script error
  • mm: Script error
  • μm: Script error
  • um: Script error (letter "u" can be used for "μ" here)

The prefix can be used in the output unit:

  • {{convert|12000|mi|Mm|abbr=on}}Script error
  • {{convert|12|in|μm|abbr=on}}Script error

As an exception, the non-SI unit "inch" can have the "μ" prefix too)

  • {{convert|12|μm|μin|abbr=on}}Script error
Script error

[edit] Engineering notation: 7 × 106 m

[edit] In the unit: e6m

Engineering number notations like 7E6 (for 7 × 106) can be entered as a "prefix" to the unit:

{{convert|7|e6m}}Script error

The same is possible for the output unit:

{{convert|23,000,000|ft|e6m}}Script error

Any standard unit (not a combination, multiple, or built-in unit) can have such a prefix:

e3 (thousand), e6 (million), e9 (billion), e12 (trillion), e15 (quadrillion).

[edit] Scientific notation: 1.23×10−14

In scientific notation, a number is written like Script error.

With {{convert}}, the input can be in e-notation such as 12.3e4. This value is displayed as a power of ten, and the output is displayed in scientific notation, except that an output value satisfying 0.01 <= v < 1000 is shown as a normal number. In addition, if the output value is 1000 and sigfig=4 is used, the value is displayed as a normal number.

  • {{convert|12.3e-15|atm|atm|abbr=on}}Script error
  • {{convert|0.00000005|atm|atm|abbr=on}}Script error

[edit] Input with fractions: Script error

The number to convert can be written in fractions. Both / (keyboard slash) and (fraction slash) are accepted:

{{convert|1/2|in|mm|1}}<code> → Script error
<code>{{convert|1⁄2|in|mm|1}}<code> → Script error

With integers, use a <code>+ sign

{{convert|2+1⁄2|in|mm|1}}<code> → Script error

When negative, use a hyphen <code>- and repeat it:

{{convert|-2-1⁄2|in|mm|1}}<code> → Script error
<code>{{convert|2-1⁄2|in|mm|1}}<code> → Script error Note: this is read as a range
<code>{{convert|-2+1⁄2|in|mm|1}}<code> → Script error 13pxN Should be a number, not an expression (do not require a calculation)

[edit] Output with horizontal fraction bar in: 1/2 inch

Using a double slash (<code>//) returns a horizontal bar fraction:

  • {{convert|1//2|in|mm|1}}Script error
  • {{convert|2+1//2|in|mm|1}}Script error

[edit] Thousands separator: 1,000 mi and 1000 mi

In input, a comma for thousands separator is accepted. A gap (space) is not. In output, by default, the thousand separator is the comma:

  • {{convert|1,234,567|m|ft}}Script error
  • {{convert|1,234,567|m|ft}}Script error
  • {{convert|1 234 567|m|ft}}Script error 13pxN

Set |comma=off to remove the separator:

  • {{convert|1234567|m|ft|comma=off}}Script error

Use |comma=gaps to set digit grouping by gap (<space>) in larger numbers (thousands separator):

  • {{convert|1234567|m|ft}}Script error (To compare, default)
  • {{convert|1234567|m|ft|comma=gaps}}Script error

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

  • {{convert|1234|m|ft}}Script error (To compare, default)
  • {{convert|1234|m|ft|comma=5}}Script error
  • {{convert|1234567|m|ft|comma=5}}Script error
  • {{convert|1234|m|ft|comma=gaps5}}Script error
  • {{convert|1234567|m|ft|comma=gaps5}}Script error

[edit] Output manipulation

[edit] Brackets and separators: 10 m [33 ft]

Punctuation that distinguishes the two measurements is set by |disp=.
Options are: b (the default), sqbr, comma, or, br, x|...:

{{convert|10|m|ft}}Script error -- ( ) brackets are the default
{{convert|10|m|ft|disp=sqbr}}Script error
{{convert|10|m|ft|disp=comma}}Script error
{{convert|10|m|ft|disp=or}}Script error

Setting |disp=br will force a new line (<br>)

{{convert|10|m|ft|disp=br}}Script error

Also |disp=br() will force a new line, and keep the brackets:

{{convert|10|m|ft|disp=br()}}Script error

Setting |disp=x|... allows any text as separator:

{{convert|10|m|ft|disp=x|_MyText_}}Script error -- (To display spaces, use &nbsp;)

[edit] Flipping (reordering) the two measurements: Script error

Setting |order=flip will flip (swap) the two measurements:

{{convert|1|mi|m}}Script error (To compare, default)
{{convert|1|mi|m|order=flip}}Script error</small>

When converting to multiple units, the effect is:

{{convert|10|km|mi nmi|order=flip}}Script error
{{convert|10|km|nmi mi|order=flip}}Script error

[edit] Displaying parts of the result: Script error

It is possible to display only parts of the conversion result:

Convert Output Description
{{convert|2|cuyd|m3}} Script error Default, to compare
{{convert|2|cuyd|m3|abbr=values}} Script error Input and output numbers
{{convert|2|cuyd|m3|disp=unit}} Script error Input unit
{{convert|2|cuyd|m3|disp=unit|adj=on}} Script error Input unit, adjective (hyphenated)
{{convert|2|cuyd|cuyd|0|disp=out|abbr=off}} Script error Input (workaround)
{{convert|2|cuyd|m3|abbr=~}} Script error Input: both name and symbol
{{convert|2|cuyd|m3|disp=unit2}} Script error Output unit (symbol)
{{convert|2|cuyd|m3|disp=unit2|abbr=off}} Script error Output unit (name)
{{convert|2|cuyd|m3|disp=number}} Script error Output value
{{convert|2|cuyd|m3|disp=out}} Script error Output value and unit
{{convert|2|cuyd|m3|disp=out|abbr=off}} Script error Output value and unit

[edit] Display input name and symbol: 2 kilopascals [kPa]

Setting |abbr=~ returns both name and symbol of the first (input) unit:

{{convert|2|kPa|psi|abbr=~}}Script error
A {{convert|2|kPa|psi|abbr=~|adj=on}} pressureA Script error pressure

[edit] Table options

For the wikitable structure, there are three options: add a line-break, split the result over columns and make the table sortable.

[edit] Enforced line break

|disp=br adds a line-break and omits brackets.

|disp=br()</nowiki> adds a lnie-break and does add brackets to the converted value. This may be useful in tables:

|disp=br |disp=br()
Script error Script error

[edit] Table columns showing numbers only

Using {convert} in a table cell, with |disp=table splits the result over two columns:

{{convert|10|m|ft|disp=table}}Script error

|disp=tablecen does the same, and also centers the text:

{{convert|20|m|ft|disp=tablecen}}Script error

The units are added as a column header:

  m ft
|disp=table Script error
|disp=tablecen Script error
|disp=<other> (default) Script error

[edit] Sorting

Use both |disp=table |sortable=on to produce table columns (pipe symbols), with sortable table column. As of January 2013, only the first (lefthand) column will sort (improvements pending).
{{convert|10|m|ft|disp=table|sortable=on}} →

Script error

This shows the hidden numerical sortkey:

align="right"|<span style="display:none">7001100000000000000</span>10 |align="right"|33

m ft
Script error
Script error
Script error
Script error

[edit] Units

Script error Script error

The table below lists units supported by template {{convert}}. The list is not complete—more complete lists are linked for each dimension. A complete list is at the full list of units.

The unit-code (column 3), is accepted as input by the template. These can be used as the second or third unnamed parameter. Some units have alternative codes; these are shown in brackets e.g. °F (F): either may be entered for Fahrenheit.

Column 7 lists standard combinations of multiple converted outputs. For example, {{convert|55|nmi|km mi}} produces "Script error". Such a combination must be used as the third unnamed parameter.

Abridged list of units supported by {{Convert}}
Explanation
system unit unit-
code
symbol or
abbrev.
notes sample default
conversion
combination
output units
the system(s) to which the unit belongs units listed by name unit-code to use in template symbols shown in output other notes about the units sample of the default conversion for the unit output codes for multiple conversions


LENGTH
(Full list)
system unit unit-
code
abbrev-
iation
notes sample default
conversion
combination
output units
SI Script error Mm Script error US spelling: megameter
Script error
Script error km Script error US spelling: kilometer
Script error
  • km mi
Script error m Script error US spelling: meter
Script error
  • m ft
  • m ftin
Script error cm Script error US spelling: centimeter
Script error
  • cm in
Script error mm Script error US spelling: millimeter
Script error
  • mm in
Script error µm (um) Script error US spelling: micrometer
Script error
Script error nm Script error US spelling: nanometer
Script error
non-SI metric Script error Å
(angstrom)
Script error Script error
Imperial
&
US customary
Script error mi Script error Script error
  • mi km
Script error furlong Script error Script error
Script error chain Script error Script error
Script error rd Script error For other names of this unit see the full list. Script error
Script error fathom Script error fathom ≡ 6 ft Script error
Script error yd Script error assumes the international definition Script error
Script error ft (foot) Script error long code "foot" outputs foot (and never feet) Script error
  • ftin (feet and inches)
  • ft m (foot m)
Script error in Script error Script error
  • in cm
  • in mm
Other Script error nmi Script error the international standard nautical mile
For other nautical miles see the full list.
Script error
Script error pc Script error Script error
Script error ly Script error Script error
Script error AU Script error Script error


AREA
(Full list)
system unit unit-
code
abbrev-
iation
notes sample default
conversion
combination
output units
SI Script error km2 Script error US spelling: square kilometer
Script error
  • km2 sqmi
Script error m2 Script error US spelling: square meter
Script error
  • m2 sqft
Script error cm2 Script error US spelling: square centimeter
Script error
  • cm2 sqin
Script error mm2 Script error US spelling: square millimeter
Script error
  • mm2 sqin
non-SI metric Script error ha Script error Script error
Imperial
&
US customary
Script error sqmi Script error Script error
  • sqmi km2
Script error acre Script error Script error
Script error sqyd Script error Script error
Script error sqft
(sqfoot)
Script error long code "sqfoot" outputs square foot (and never feet) Script error
  • sqft m2 (sqfoot m2)
Script error sqin Script error Script error
  • sqin cm2
Other Script error sqnmi Script error Script error
Script error dunam Script error For alternative spellings and definitions see the full list Script error
Script error tsubo Script error Script error


VOLUME
(Full list)
system unit unit-
code
abbrev-
iation
notes sample default
conversion
combination
output units
SI Script error m3 Script error US spelling: cubic meter
one kilolitre
Script error
Script error cm3 Script error US spelling: cubic centimeter
one millilitre
Script error
cc Script error
Script error mm3 Script error US spelling: cubic millimeter
Script error
non-SI metric Script error kl Script error US spelling: kiloliter
one cubic metre
Script error
kL Script error
Script error l Script error US spelling: liter
one cubic decimetre
Allows triple output units. See: full list.
Script error
  • l impgal
  • l USgal
  • l U.S.gal
  • l USdrygal
  • l U.S.drygal
L Script error
  • L impgal
  • L impqt
  • L USgal
  • L U.S.gal
  • L USdrygal
  • L U.S.drygal
Script error cl Script error US spelling: centiliter
Script error
cL Script error
Script error ml Script error US spelling: milliliter
one cubic centimetre
Script error
  • ml impoz
  • ml USoz
  • ml U.S.oz
mL Script error
  • mL impoz
  • mL USoz
  • mL U.S.oz
Imperial
&
US customary
Script error cuyd Script error Script error
Script error cuft (cufoot) Script error long code "cufoot" outputs cubic foot (and never feet) Script error
Script error cuin Script error Script error
Imperial Script error impbbl Script error 36 imp gal Script error
Script error impbsh Script error 8 imp gal Script error
impbu Script error
Script error impgal Script error 4.54609 litres by definition, also
4 imp qt or 8 imp pt or 160 imp fl oz
Allows triple output units. See: full list.
Script error
  • impgal l
  • impgal L
  • impgal USgal
  • impgal U.S.gal
  • impgal USdrygal
  • impgal U.S.drygal
Script error impqt Script error 1/4 imp gal or 40 imp fl oz Script error
Script error imppt Script error 1/8 imp gal or 20 imp fl oz Script error
Script error impoz (impfloz) Script error 1/160 imp gal Script error
  • impoz USoz
  • impoz U.S.oz
  • impoz ml
  • impoz mL
US customary
liquid measure
Script error USbbl Script error 31½ US gal
used for liquids except for oil and beer (see the full list)
Script error
U.S.bbl Script error
Script error oilbbl Script error 42 US gal Script error
Script error USbeerbbl
(usbeerbbl)
Script error Script error
U.S.beerbbl
(usbeerbbl)
Script error
Script error USgal Script error 231 cubic inches by definition, also
4 US qt or 8 US pt or 128 US fl oz
Allows triple output units. See: full list.
Script error
  • USgal l
  • USgal L
  • USgal impgal
U.S.gal Script error
  • USgal l
  • USgal L
  • USgal impgal
Script error USqt Script error 1/4 US gal or 32 US fl oz Script error
U.S.qt Script error
Script error USpt Script error 1/8 US gal or 16 US fl oz Script error
U.S.pt Script error
Script error USoz
(USfloz)
Script error 1/128 US gal Script error
  • USoz ml
  • USoz mL
  • USoz impoz
U.S.oz
(U.S.floz)
Script error
  • U.S.oz ml
  • U.S.oz mL
  • U.S.oz impoz
US customary
dry measure
Script error USdrybbl Script error 105/32 US bsh Script error
U.S.drybbl Script error
Script error USbsh Script error 2150.42 cubic inches by definition Script error
U.S.bsh Script error
Script error USbu Script error 2150.42 cubic inches by definition Script error
U.S.bu Script error
Script error USdrygal Script error 1/8 US bsh
Allows triple output units. See: full list.
Script error
  • USdrygal l
  • USdrygal L
  • USdrygal impgal
U.S.drygal Script error
  • U.S.drygal l
  • U.S.drygal L
  • U.S.drygal impgal
Script error USdryqt Script error 1/32 US bsh Script error
U.S.dryqt Script error
Script error USdrypt Script error 1/32 US bsh Script error
U.S.drypt Script error


SPEED
(Full list)
system unit unit-
code
abbrev-
iation
notes sample default
conversion
combination
output units
SI Script error m/s Script error US spelling: meter per second
Script error
  • m/s ft/s (m/s foot/s)
non-SI metric Script error km/h Script error US spelling: kilometer per hour
Script error
  • km/h mph
Imperial
&
US customary
Script error mph Script error Script error
  • mph km/h
  • mph kn
Script error ft/s (foot/s) Script error long code "foot/s" outputs foot per second (and never feet) Script error
  • ft/s m/s
Maritime units Script error kn (knot) Script error Script error
  • kn mph


FORCE
(Full list)
system unit unit-
code
abbrev-
iation
notes sample default
conversion
combination
output units
SI Script error GN Script error Allows triple output units. See: full list. Script error
  • GN LT-f
  • GN LTf
  • GN ST-f
  • GN STf
Script error MN Script error Allows triple output units. See: full list. Script error
  • MN LT-f
  • MN LTf
  • MN ST-f
  • MN STf
Script error kN Script error Allows triple output units. See: full list. Script error
  • kN LT-f
  • kN LTf
  • kN ST-f
  • kN STf
Script error N Script error Script error
  • N lb-f
  • N lbf
  • N oz-f
  • N ozf
Script error mN Script error Script error
  • mN oz-f
  • mN ozf
  • mN gr-f
  • mN grf
Script error µN (uN) Script error Script error
  • µN gr-f
  • µN grf
Script error nN Script error Script error
  • nN gr-f
  • nN grf
cgs Script error Mdyn Script error Script error
Script error kdyn Script error Script error
Script error dyn
(dyne)
Script error Script error
Script error mdyn Script error Script error
Metric gravitational units Script error t-f Script error Script error
tf Script error
Script error kg-f Script error Script error
kgf Script error
Script error g-f Script error Script error
gf Script error
Script error mg-f Script error Script error
mgf Script error
Avoirdupois-based units Script error pdl Script error Script error
Script error LT-f Script error Script error
  • LT-f ST-f
LTf Script error
  • LTf STf
Script error ST-f Script error Script error
  • ST-f LT-f
STf Script error
  • STf LTf
Script error lb-f Script error Script error
lbf Script error
Script error gr-f Script error Script error
grf Script error


ENERGY
(Full list)
system unit unit-
code
abbrev-
iation
notes sample default
conversion
combination
output units
SI Script error GJ Script error Script error
Script error MJ Script error Script error
Script error kJ Script error Script error
Script error hJ Script error Script error
Script error daJ Script error Script error
Script error J Script error Script error
Script error dJ Script error Script error
Script error cJ Script error Script error
Script error mJ Script error Script error
Script error µJ (uJ) Script error Script error
Script error nJ Script error Script error
cgs Script error Merg Script error Script error
Script error kerg Script error Script error
Script error erg Script error Script error
Watt-hour multiples Script error TWh Script error Script error
TW.h Script error
Script error GWh Script error Script error
GW.h Script error
Script error MWh Script error Script error
MW.h Script error
Script error kWh Script error Script error
kW.h Script error
Script error Wh Script error Script error
W.h Script error
Electron-
volt
multiples
Script error GeV Script error Script error
Script error MeV Script error Script error
Script error keV Script error Script error
Script error eV Script error Script error
Script error meV Script error Script error
Calorie multiples Script error Cal Script error The thermo-chemical calorie is the default definition. For others, see the full list. Script error
Script error Mcal Script error Script error
Script error kcal Script error Script error
Script error cal Script error Script error
Script error mcal Script error Script error
pound/
ounce
-foot/
inch-hour-minute-second
Script error ftpdl Script error Script error
Script error ftlbf Script error Script error
ftlb-f Script error
Script error inlbf Script error Script error
inlb-f Script error
Script error inozf Script error Script error
inoz-f Script error
Script error hph Script error Script error
British thermal unit Script error Btu Script error The International Steam Table British thermal unit is used. For others, see the full list. Script error
BTU Script error
TNT-based units Script error GtTNT Script error Script error
Script error GtonTNT Script error
Script error MtTNT Script error Script error
Script error MtonTNT Script error
Script error ktTNT Script error Script error
Script error ktonTNT Script error
Script error tTNT Script error Script error
Script error tonTNT Script error
Other
Script error Eh Script error Script error
Script error Ry Script error Script error
Script error toe Script error Script error
Script error BOE Script error Script error
cubic foot of natural gas cuftnaturalgas (cufootnaturalgas) Unit-code cufootnaturalgas will show "cubic foot of natural gas" if plural. Script error
Script error latm Script error Script error
Latm Script error
Script error impgalatm Script error Script error
Script error USgalatm
(usgalatm)
Script error Script error
U.S.galatm
(usgalatm)
Script error


TEMPERATURE
(Full list)
system unit unit-
code
abbrev-
iation
notes sample default
conversion
combination
output units
SI Script error K Script error Allows triple output units. See: full list. Script error
  • K °C (K C)
  • K °R (K R)
  • K °F (K F)
Script error °C (C) Script error Script error
  • °C K (C K)
  • °C °R (C R)
  • °C °F (C F)
Imperial
&
US customary
Script error °R (R) Script error Script error
  • °R K (R K)
  • °R °C (R C)
  • °R °F (R F)
Script error °F (F) Script error Script error
  • °F K (F K)
  • °F °C (F C)
  • °F °R (F R)
Celsius change C-change Used for temperature intervals instead of actual temperatures
Example:  {{convert|5|C-change|0}} warmer
Result: Script error warmer
Fahrenheit change F-change Used for temperature intervals instead of actual temperatures
Example:  {{convert|10|F-change|0}} colder
Result: Script error colder


MASS
(Full list)
system unit unit-
code
abbrev-
iation
notes sample default
conversion
combination
output units
SI Script error kg Script error Allows triple output units. See: full list. Script error
  • kg lb
  • kg st
Script error g Script error Script error
  • g oz
Script error mg Script error Script error
  • mg gr
Script error µg (ug) Script error Script error
non-SI metric Script error t Script error Allows triple output units. See: full list. Script error
  • t LT
  • t ST
Script error MT Script error
  • MT LT
  • MT ST
Avoirdupois Script error LT Script error 2,240 lb
used mostly in the British Commonwealth.
Allows triple output units. See: full list.
Script error
  • LT t
  • LT MT
  • LT ST
long ton Script error
Script error ST Script error 2,000 lb
used mostly in the US.
Allows triple output units. See: full list.
Script error
  • ST t
  • ST MT
  • ST LT
short ton Script error
Script error st Script error 14 lb
used mostly in the British Commonwealth except Canada.
Allows triple output units. See: full list.
Script error
  • st kg
  • st lb
Script error lb Script error Allows triple output units. See: full list. Script error
  • lb kg
  • lb st
Script error oz Script error Script error
  • oz g
Script error drachm Script error Script error
Script error dram Script error
Script error gr Script error equivalent to the troy grain Script error
Troy Script error ozt Script error Script error
other Script error carat Script error Script error


TORQUE
(Full list)
system unit unit-
code
abbrev-
iation
notes sample default
conversion
combination
output units
Industrial
SI Script error Nm Script error Triple combinations are also possible. See the full list. Script error
  • Nm kg.m
  • Nm lb.ft
Non-SI metric Script error kg.m Script error Script error
  • kg.m Nm
  • kg.m lb.ft
Imperial
&
US customary
Script error lb.ft Script error Script error
  • lb.ft Nm
  • lb.ft kg-m
Scientific
SI Script error N.m Script error Triple combinations are also possible. See the full list. Script error
  • N.m kgf.m
  • N.m lbf.ft
Non-SI metric Script error kgf.m Script error Script error
  • kgf.m N.m
  • kgf.m lbf.ft
Imperial
&
US customary
Script error lbf.ft Script error Script error
  • lbf.ft N.m
  • lbf.ft kgf.m
DENSITY
(Full list)
system unit unit-
code
abbrev-
iation
notes sample default
conversion
combination
output units
Metric Script error kg/m3 Script error Script error
  • kg/m3 lb/ft3 (kg/m3 lb/cuft)
  • kg/m3 lb/yd3 (kg/m3 lb/cuyd)
Script error g/m3 Script error Script error
  • g/m3 kg/m3
  • g/m3 lb/ft3 (g/cm3 lb/cuft)
  • g/m3 lb/yd3 (g/cm3 lb/cuyd)
Imperial
&
US customary
Script error lb/ft3 Script error Script error
  • lb/ft3 kg/m3 (lb/cu ft g/m3)
  • lb/ft3 g/m3 (lb/cu ft g/m3)
Script error lb/yd3 Script error Script error
  • lb/yd3 kg/m3 (lb/cuyd kg/m3)
  • lb/yd3 g/m3 (lb/cuyd g/m3)


PRESSURE
unit unit-
code
abbrev-
iation
sample default
conversion
Script error GPa Script error Script error
Script error MPa Script error Script error
Script error kPa Script error Script error
Script error hPa Script error Script error
Script error Pa Script error Script error
Script error mPa Script error Script error
Script error mbar Script error Script error
mb Script error
Script error dbar Script error Script error
Script error bar Script error Script error
Script error kBa Script error Script error
Script error Ba Script error Script error
Script error atm Script error Script error
Script error Torr Script error Script error
Script error mmHg Script error Script error
Script error inHg Script error Script error
Script error psi Script error Script error
FUEL EFFICIENCY
unit unit-
code
notes combinations
kilometres per litre km/l (km/L) Use km/L to get "km/L"
  • km/l mpgimp
  • km/l mpgus
litres per 100 kilometres l/100 km (L/100 km) Use L/100 km to get "L/100 km"
  • l/100 km mpgimp
  • l/100 km mpgus
litres per kilometre l/km (L/km) Use L/km to get "L/km"
  • l/km impgal/mi
  • l/km usgal/mi
miles per imperial gallon mpgimp
  • mpgimp mpgus
miles per US gallon mpgus (mpgUS, mpgU.S.) Use mpgUS to get "US"

Use mpgU.S. to get "U.S."
mpgus will give "U.S." if spelling is
set to US & "US" otherwise

  • mpgus mpgimp
imperial gallons per mile impgal/mi
  • impgal/mi
US gallons per mile usgal/mi (USgal/mi, U.S.gal/mi) As above with the us vs US vs U.S.
  • usgal/mi
The mpgUS, mpgU.S., USgal/mi vs U.S.gal/mi, km/L, L/100 km and L/km variants work within combinations also (making 36 combinations in total).
POWER
Watts, kilowatts, milliwatts, etc. are supported. As is horsepower (English & metric). Use standard abbreviations as input code (lowercase hp for horsepower, for example)
POPULATION DENSITY
unit unit-
code
notes combinations
inhabitants per square kilometre PD/sqkm PD stands for population density, i.e. humans (inhabitants)
  • PD/sqkm PD/sqmi
per square kilometre /sqkm Used when the word 'inhabitants' would be inappropriate.
  • /sqkm /sqmi
inhabitants per hectare PD/ha
  • PD/ha PD/acre
per hectare /ha
  • /ha /acre
inhabitants per square mile PD/sqmi PD stands for population density, i.e. humans (inhabitants)
  • PD/sqmi PD/sqkm
per square mile /sqmi Used when the word 'inhabitants' would be inappropriate.
  • /sqmi /sqkm
inhabitants per acre PD/acre
  • PD/acre PD/ha
per acre /acre
  • /acre /ha
COST PER UNIT MASS
unit unit-
code
notes combinations
dollars per pound $/lb "$" can mean US$, HK$, etc.
  • (none)
dollars per kilogram $/kg
  • (none)
dollars per troy ounce $/ozt 12 troy ounces in 1 troy pound
  • (none)

[edit] 'per' units: kg/hl

When using a slash (/), a unit like kg/hl is recognized as kilograms per hectolitre and will be converted with other mass/volume units.

  • {{convert|1000|kg/hl}}Script error

[edit] Parameter list

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

[edit] Deprecated options

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

[edit] TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools.

Convert/doc

<templatedata>{ "description": "Converts measurements to other units.", "params": { "1": {

 "label": "value",
 "description": "the value to convert",
 "type": "number"

}, "2": {

 "label": "from unit",
 "description": "",
 "type": "string/line"

}, "3": {

 "label": "to units",
 "description": "the unit to convert into",
 "type": "string/line"

}, "4": {

 "label": "precision or suffix",
 "description": "significant digits after decimal dot or, if negative, exponent of ten",
 "type": "number"

}, "lk": {

 "label": "link units",
 "description": "“on” all, “in” input, “out” output or “off” no units",
 "default": "off",
 "type": "string/line"

}, "abbr": {

 "label": "abbreviation",
 "description": "display for the units: “on” unit symbols, “off” all unit names in full words, “in” input unit symbol, “out” abbreviated output units, “values” no units at all",
 "default": "out",
 "type": "string/line"

}, "sp": {

 "label": "spelling",
 "description": "“us” display U.S. spelling of unit names",
 "type": "string/line"

}, "adj": {

 "label": "adjective",
 "description": "adjective form (singular unit name appended by hyphen) “on” or “mid” to put conversion at end",
 "type": "string/line"

}, "disp": {

 "label": "conversion",
 "description": "display conversion result: “or” after ‘or’, “x” with custom prefix and suffix, “b” in parentheses, “table”/“tablecen”, “output only” alone, “output number only” alone and without unit, “unit” not at all but input unit; if the value is a number it is used as precision",
 "default": "b",
 "type": "string/line"

}, "order": {

 "label": "ordering",
 "description": "“flip” returns converted value first, input value second.",
 "type": "string/line"

}, "sigfig": {

 "label": "significant figures",
 "description": "number that sets the number of significant figures",
 "type": "number"

}, "round": {

 "label": "rounding output",
 "description": "“5” rounds the output number to nearest multiple of 5, “25” to nearest multiple of 25, “each” rounds each number in a range",
 "type": "string/line"

}, "comma": {

 "label": "thousands separator",
 "description": "Sets or suppresses thousand separator in the numbers. “off” = no separator; “gaps”: use space not comma; “5” and “gaps5”: only add separator when number > 5 positions (10,000 or more)",
 "default": "on",
 "type": "string/line"

}, "sortable": {

 "label": "sort key",
 "description": "“on” generates a hidden sort key",
 "type": "string/line"

} }}</templatedata>

[edit] See also

Script error

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox
Share