Template:Convert

From Zoophilia Wiki
Revision as of 06:56, 17 April 2007 by meta>Drumguy8800 (rework nobr)
Jump to navigationJump to search

{{#ifeq:{Template:BrTemplate:SprotectedTemplate:Esoteric

For currency conversion into US dollars, see Template:To USD

Template {{convert}} calculates from one measurement unit to another one, and then presents the results formatted. The complete list of unit symbols recognized by the template is at Module:Convert/documentation/conversion data.

For example:

{{convert|2|km|mi}} → {{#ifeq:{Template:Br (km entered, so converted into mile)
{{convert|7|mi|km}} → {{#ifeq:{Template:Br (mi entered, so converted into km)

Numbers can be rounded, units can be abbreviated into symbols:

{{convert|2|km|mi|2|abbr=on}} → {{#ifeq:{Template:Br
{{convert|7|mi|km|2|abbr=on}} → {{#ifeq:{Template:Br

Value ranges can be entered using |to|... or |-|...:

{{convert|2|to|5|km|mi}} → {{#ifeq:{Template:Br
{{convert|2|-|5|km|mi}} → {{#ifeq:{Template:Br

Combined effect example:

{{convert|2|-|5|km|mi|2|abbr=on}} → {{#ifeq:{Template:Br
{{convert|2|and|5|km|mi|sigfig=3|abbr=off}} → {{#ifeq:{Template:Br
See Help:Convert for more detailed, technical information

Units to convert

Enter units to convert from into:

SI units generally accept prefixes, like "m" for milli (10−3), and "M" for mega (106)
For "per" units, use "/" (slash): kg/ha
For three-unit units, etc., see Category:Convert-like templates

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

By default, the first quantity shows the unit name, the second shows the symbol (or abbreviation):

Using |abbr=in is the reverse behaviour to the default:

To abbreviate both or neither:

Convenience: {{cvt}} has |abbr=on by default

Template {{cvt}} is the same as {{convert}}, except that it has |abbr=on as the default behaviour. In {{cvt}}, all other options are available. So:

{{cvt|1|lb|kg}} → 1 lb (0.45 kg)

is equivalent to:

{{convert|1|lb|kg|abbr=on}} → 1 lb (0.45 kg)

Adjective: a 10-mile distance

Use |adj=on to produce the adjectival (hyphenated) form:

  • A {{convert|10|mi|km|adj=on}} distance → A {{#ifeq:{Template:Br distance.

Default behaviour, for comparison:

  • {{convert|10|mi|km}} to go → {{#ifeq:{Template:Br to go.

|adj=on does not produce hyphens with unit symbols, as per Manual of Style:

  • A {{convert|9|in|cm|adj=on|abbr=on}} nail → A {{#ifeq:{Template:Br nail.

Rounding: 100 ft is 30 m or 30.5 m or 30.48 m?

See Help:Convert § Rounding for a more mathematical description of the rounding options

By definition, 100 ft equals {{#ifeq:{Template:Br. In practical use, it is common to round the calculated metric number. With that, there are several possibilities.

Default rounding

By {{Convert}} 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 digits, 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}} {{#ifeq:{Template:Br
{{convert|123|ft|m}} {{#ifeq:{Template:Br same output as with 0 (below)
{{convert|123|ft|m|0}} {{#ifeq:{Template:Br
{{convert|123|ft|m|1}} {{#ifeq:{Template:Br
{{convert|123|ft|m|2}} {{#ifeq:{Template:Br The more-exact value is 37.4904 m or so, which gets converted to 37 m if this parameter is not specified at all.
{{convert|500|ft|m|-1}} {{#ifeq:{Template:Br
{{convert|500|ft|m}} {{#ifeq:{Template:Br same output as with −1 (above), because the conversion factor is between 0.2 and 2 (hence, it should produce same double-zero precision (−2) as in the input value), but the conversion must produce two significant digits at a minimum (hence, a higher single-zero precision (−1) is used)
{{convert|500|ft|m|0}} {{#ifeq:{Template:Br
{{convert|500|ft|m|1}} {{#ifeq:{Template:Br
{{convert|500|ft|m|2}} {{#ifeq:{Template:Br exact value is 152.4 m
{{convert|500|ft|cm|-3}} {{#ifeq:{Template:Br
{{convert|500|ft|cm}} {{#ifeq:{Template:Br same output as with −3 (above), because the conversion factor is between 20 and 200 (hence, it should decrease input value's double-zero precision (−2) by 2), but the conversion must produce two significant digits at a minimum (hence, a higher triple-zero precision (−3) is used)
{{convert|500|ft|cm|0}} {{#ifeq:{Template:Br

Convert supports four types of rounding:

Round to a given precision: use a precision number

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 multiple of ​110 to the power of 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.

Round to a given number of significant figures: |sigfig=

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

  • {{convert|1200|ft|m|sigfig=4}} → {{#ifeq:{Template:Br
  • {{convert|1200|ft|m|sigfig=3}} → {{#ifeq:{Template:Br
  • {{convert|1200|ft|m|sigfig=2}} → {{#ifeq:{Template:Br
  • {{convert|1200|ft|m|sigfig=1}} → {{#ifeq:{Template:Br

Default behaviour, for comparison:

Setting |sigfig= to a value less than 1 is meaningless:

  • {{convert|1200|ft|m|sigfig=0}} → {{#ifeq:{Template:Br Red XN

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

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

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

Default behaviour, for comparison:

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

  • {{convert|10 x 200 x 3000|m|ft}} → {{#ifeq:{Template:Br
  • {{convert|10 x 200 x 3000|m|ft|round=each}} → {{#ifeq:{Template:Br

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).

The fraction is reduced when possible:

Default behaviour uses decimal notation:

Rounding temperatures: °C, °F and K

In temperatures, the conversion will be rounded either to the 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.

  1. {{convert|10,000|C|F K}} → {{#ifeq:{Template:Br
  2. {{convert|10,000.1|C|F K}} → {{#ifeq:{Template:Br
  3. {{convert|-272|C|F K}} → {{#ifeq:{Template:Br
  4. {{convert|-272|C}} → {{#ifeq:{Template:Br
  5. {{convert|100|C|F K}} → {{#ifeq:{Template:Br
  6. {{convert|0|C|F K}} → {{#ifeq:{Template:Br

The precision of the input number in example (1) is one digit, but the precision of its Kelvins expression is three, so the precision of the Fahrenheit conversion is made three (made 180...) . (1) and (2) seem to belie the fact that a {{#ifeq:{Template:Br, and make the 32 degrees difference shown in (1) begin to seem off somehow. Result (1) seems off until you set the significant figures yourself with |sigfig=:

{{convert|10000|C|sigfig=5}} → {{#ifeq:{Template:Br

or you set the precision positionally, relative to the decimal point (zero being at the decimal point):

{{convert|10000|C|0}} → {{#ifeq:{Template:Br

The precision of the input number in example (2) is six, so the precision of the Fahrenheit output is, whereas before, Kelvins had determined it to be three. Examples (3) and (4) show how this can be hidden and generate questions, but it occurs there because the Kelvins conversion generated two fractional parts. (Before it was the input number that generated the fractional part.) In example (3) the three input digits converted into five significant output digits because of the two digits after the decimal point, generated by the Kelvins conversion. This happened again in (5), but in (6) decimal fractions were neither given as input nor induced by the Kelvins conversion.

Rounding input

There is limited support for rounding the displayed input number. The rounding takes place after conversion, so the output is based on the full-precision input. This is useful when the input is produced by {{#expr:}} or otherwise available to a higher precision than is usefully displayed, and it's desirable to avoid double-rounding.

To round the input to a specified number of digits after the decimal point, use one of the parameters:

  • |adj=ri0
  • |adj=ri1
  • |adj=ri2
  • |adj=ri3

Note that there is no |adj=ri-1Red XN or similar for rounding above the decimal place. Neither is there support for significant figures, multiples of 5, or any other output-rounding feature.

The default precision is computed based on the input, so an explicit output precision must usually be supplied:

  • {{convert|4.14159|mi|km|adj=ri0}} → {{#ifeq:{Template:Br Red XN (precisions are mismatched)
  • {{convert|4.14159|mi|km|0|adj=ri0}} → {{#ifeq:{Template:Br Green tickY

In this case, if the input were rounded before conversion, a different result would be obtained:

  • {{convert|{{#expr:4.14159 round 0}}|mi|km|0}} → {{#ifeq:{Template:Br Red XN (double rounding)

Into multiple units: {{#ifeq:{Template:Br

Separate the multiple output units by a space:

If the output unit names contain spaces, use + as the separator.

See also:

Ranges of values

A range converts two values and separates them by your choice of words and punctuation.

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:

Separator Convert Result Notes
- {{convert|3|-|6|ft}} {{#ifeq:{Template:Br Input can be hyphen (-) or en dash (–), output uses en dash
 &ndash; (en dash) {{convert|3|–|6|ft}} {{#ifeq:{Template:Br
and {{convert|3|and|6|ft}} {{#ifeq:{Template:Br
and(-) {{convert|3|and(-)|6|ft}} {{#ifeq:{Template:Br |abbr=on abbreviates the first unit
and(-)|abbr=on {{convert|3|and(-)|6|ft|abbr=on}} {{#ifeq:{Template:Br
or {{convert|3|or|6|ft}} {{#ifeq:{Template:Br
to {{convert|3|to|6|ft}} {{#ifeq:{Template:Br
to(-) {{convert|3|to(-)|6|ft}} {{#ifeq:{Template:Br |abbr=on abbreviates the first unit
to(-)|abbr=on {{convert|3|to(-)|6|ft|abbr=on}} {{#ifeq:{Template:Br
to about {{convert|3|to about|6|ft}} {{#ifeq:{Template:Br
+/- {{convert|3|+/-|6|ft}} {{#ifeq:{Template:Br
± &plusmn; {{convert|3|±|6|ft}} {{#ifeq:{Template:Br
+ {{convert|3|+|6|ft}} {{#ifeq:{Template:Br
, {{convert|3|,|6|ft}} {{#ifeq:{Template:Br
, and {{convert|3|, and|6|ft}} {{#ifeq:{Template:Br
, or {{convert|3|, or|6|ft}} {{#ifeq:{Template:Br
by {{convert|3|by|6|ft}} {{#ifeq:{Template:Br
x {{convert|3|x|6|ft}} {{#ifeq:{Template:Br |abbr=on abbreviates and repeats the first unit
× &times; {{convert|3|×|6|ft}} {{#ifeq:{Template:Br
x|abbr=on {{convert|3|x|6|ft|abbr=on}} {{#ifeq:{Template:Br
xx |xx| is deprecated. Use |x| instead
* |*| is deprecated. Use |x| instead

Multiple dimensions: {{#ifeq:{Template:Br

Use by:

Use ×, multiplication sign, or x, letter:

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}} → {{#ifeq:{Template:Br

Lists of values: 20, 40, or 60 miles

{{convert|20|,|40|, or|60|mi}} → {{#ifeq:{Template:Br

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|x|3|ft|5|in|mm}} → {{#ifeq:{Template:Br Red XN

Default behaviour, for comparison:

However, converting metric units into feet and inches with |order=flip can produce the desired output:

  • {{convert|380|x|1040|mm|ftin|order=flip}} → {{#ifeq:{Template:Br

Words

Spelling of unit name: international metre or US meter?

Default spelling of units is in the en (generic) locale. To show en-US spelling, use |sp=us:

{{convert|1|m|ft}} → {{#ifeq:{Template:Brdefault
{{convert|1|m|ft|sp=us}} → {{#ifeq:{Template:Br

Spell out numbers: ten miles

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

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

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

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}} → {{#ifeq:{Template:Br

Inserted before units: 4 planted acres

  • {{convert|4|acre||adj=pre|planted}} → {{#ifeq:{Template:Br

disp=preunit is similar, but has no separator after the specified text, and can have different text for the output value:

  • {{convert|4|acre||disp=preunit|planted }} → {{#ifeq:{Template:Br
  • {{convert|4|acre||disp=preunit|planted |reforested-}} → {{#ifeq:{Template:Br

After adjective unit: A {{#ifeq:{Template:Br corridor

Note that two units (in this case, ft and m) are required. Use with just one unit will generate an error message.

{{convert|10|ft|m|adj=mid|-long}} → {{#ifeq:{Template:Br

Plurals: 1 inch, 2 inches

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

Exception

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

Fractions: one-eighth of an imperial pint

The convert template also supports spelling out fractions.

  • {{convert|3+1/2|oz|g|spell=in}} → {{#ifeq:{Template:Br

Any additional words needed for the fraction can also be added at the end of the template.

  • {{convert|1/8|imppt|ml|spell=in|adj=pre|of an}} → {{#ifeq:{Template:Br

Wrapping and line breaking

See Help:Convert § Wrapping and line breaking

Spelling out "thousands", "millions", etc.

Most unit codes accept a prefix of e3 (thousand) or e6 (million) or e9 (billion).

To display both input and output in scientific notation, use |abbr=on

  • {{convert|100|e6mi|e6km|abbr=on}} → {{#ifeq:{Template:Br

To spell out "thousands", "millions", etc., |abbr=unit abbreviates the unit; |abbr=off displays both full unit names.

  • {{convert|100|e6mi|e6km|abbr=unit}} → {{#ifeq:{Template:Br
  • {{convert|100|e6mi|e6km|abbr=off}} → {{#ifeq:{Template:Br

Numbers

Using an SI prefix: gigametre (Gm), or micrometre (μm)

Template:Sidebar metric prefixes (small) Units can have an SI prefix like G before the unit: Gm, and giga before the name: gigametre. These are plain multiplication factors.

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

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

The prefix can be used in the output unit:

  • {{convert|12000|mi|Mm|abbr=on}} → {{#ifeq:{Template:Br
  • {{convert|12|in|μm|abbr=on}} → {{#ifeq:{Template:Br

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

  • {{convert|12|μm|μin|abbr=on}} → {{#ifeq:{Template:Br

Engineering notation: 7 × 106 m

In the unit: e6m

Engineering notation can be entered as a "prefix" to the unit:

The same is possible for the output unit:

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).

Scientific notation: 1.23 × 10−14

In scientific notation, a number is written like 1.23×10−14. The plain number has exactly one digit before the decimal point.

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}} → {{#ifeq:{Template:Br
  • {{convert|0.00000005|atm|atm|abbr=on}} → {{#ifeq:{Template:Br

Input with fractions: {{#ifeq:{Template:Br

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

With positive mixed numbers (a positive integer and a fraction), use a + sign

With negative mixed numbers, use a hyphen - and repeat it:

Note that the following cases are not interpreted as mixed numbers:

  • {{convert|2-1⁄2|in|mm|1}} → {{#ifeq:{Template:Br. This is interpreted as a range from 2 inches to 1⁄2 inch.
  • {{convert|-2+1⁄2|in|mm|1}} → {{#ifeq:{Template:Br Red XN This is neither a mixed number nor a range, and mathematical expressions requiring calculations are not allowed here.

Horizontal fraction bar: 1/2 inch

Using a double slash (//) provides a horizontal fraction bar for the original (input) unit:

Using a negative value for |frac= provides a horizontal fraction bar for the converted (output) unit:

Thousands separator: 1,000 mi or 1000 mi

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

Set |comma=off to remove the separator from the output:

  • {{convert|1234567|m|ft|comma=off}} → {{#ifeq:{Template:Br

Use |comma=gaps to use digit grouping by gap (thin space) as a thousands separator:

  • {{convert|1234567|m|ft|comma=gaps}} → {{#ifeq:{Template:Br

Default behaviour, for comparison:

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

  • {{convert|1234|m|ft|comma=5}} → {{#ifeq:{Template:Br
  • {{convert|1234567|m|ft|comma=5}} → {{#ifeq:{Template:Br

Default behaviour, for comparison:

Output manipulation

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, br(), x|…:

Default behaviour, for comparison:

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

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

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

  • {{convert|10|m|ft|disp=x|_MyText_}} → {{#ifeq:{Template:Br (To display spaces, use &nbsp;)

Flipping (reordering) the two measurements: {{#ifeq:{Template:Br

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

Default behaviour, for comparison:

When converting to multiple units, the effect is:

  • {{convert|10|km|mi nmi|order=flip}} → {{#ifeq:{Template:Br
  • {{convert|10|km|nmi mi|order=flip}} → {{#ifeq:{Template:Br

Fixed ordering of output units: {{#ifeq:{Template:Br

Setting |order=out shows the output-units as ordered; the input unit is skipped:

  • {{convert|100|C|F C K|abbr=on|order=out}} → {{#ifeq:{Template:Br
  • {{convert|200|PS|kW hp|0|abbr=on|order=out}} → {{#ifeq:{Template:Br

See also: § Displaying parts of the output.

Displaying parts of the result: {{#ifeq:{Template:Br

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

Convert Output Returns
{{convert|2|cuyd|m3}} {{#ifeq:{Template:Br Regular output (for comparison)
{{convert|2|cuyd|m3|abbr=values}} {{#ifeq:{Template:Br Input and output numbers
{{convert|2|cuyd|m3|disp=unit}} {{#ifeq:{Template:Br Input unit
{{convert|2|cuyd|m3|disp=unit|adj=on}} {{#ifeq:{Template:Br Input unit, adjective (hyphenated)
{{convert|2|cuyd|cuyd|disp=out}} {{#ifeq:{Template:Br Input (workaround. Note repetition of unit in input)
{{convert|2|cuyd|m3|abbr=~}} {{#ifeq:{Template:Br Input: both name and symbol
{{convert|2|cuyd|m3|disp=unit2}} {{#ifeq:{Template:Br Output unit (symbol)
{{convert|2|cuyd|m3|disp=unit2|abbr=off}} {{#ifeq:{Template:Br Output unit (name)
{{convert|2|cuyd|m3|disp=number}} {{#ifeq:{Template:Br Output value
{{convert|2|cuyd|m3|disp=out}} {{#ifeq:{Template:Br Output value and unit name
{{convert|2|cuyd|m3|disp=out|abbr=off}} {{#ifeq:{Template:Br Output value and unit symbol

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

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

  • {{convert|2|kPa|psi|abbr=~}} → {{#ifeq:{Template:Br
  • A {{convert|2|kPa|psi|abbr=~|adj=on}} pressureA {{#ifeq:{Template:Br pressure

Table options

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

Enforced line break

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

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

|disp=br |disp=br()
{{#ifeq:{Template:Br {{#ifeq:{Template:Br

Table columns

Using {convert} in a table cell, with |disp=table splits the result over two (or more) columns. By default units are not included in the table, however, they can be added using the |abbr= parameter. Multiple-unit outputs, like ftin, always output their units to the table.

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

{{#ifeq:{Template:Br

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

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

{{#ifeq:{Template:Br

The units are added as a column header:

  kilograms pounds stone and pounds
|disp=table {{#ifeq:{Template:Br
|disp=table and |abbr=on {{#ifeq:{Template:Br
|disp=table and |abbr=off {{#ifeq:{Template:Br
|disp=tablecen {{#ifeq:{Template:Br
|disp=<other> (default) {{#ifeq:{Template:Br

Sorting

Use |sortable=on to include a hidden numerical sortkey in the output, suitable for use in a table with sortable columns. Technically, this places a hidden string before the actual displayed values:

{{convert|10|m|ft|sortable=on}} <span data-sort-value="7001100000000000000♠"></span>10 metres (33 ft)
showing: {{#ifeq:{Template:Br.

Use both |disp=table and |sortable=on together to produce table columns (pipe symbols) for each value in sortable columns:

m m ft
A 15.75 m {{#ifeq:{Template:Br
B 15.5 m {{#ifeq:{Template:Br
C 16 m {{#ifeq:{Template:Br
D 16 m {{#ifeq:{Template:Br

The generated sortkey is calculated in a consistent way based on both the value and its unit as passed to the convert template. In most cases convert uses the passed value converted to SI base units. It is therefore not necessarily the displayed value or other alternate units and is calculated regardless of output format options. Using different units or different order of units in individual rows should therefore not lead to incorrect sorting, although variations in rounding can give surprising results, since an unrounded number is used for the sortkey.

Units

The conversion factors and physical constants are sourced here.

All units

Units are case-sensitive: use kW, not KW or kw

The table below lists units supported by {{convert}}. More complete lists are linked for each dimension. For a complete list of all dimensions, see full list of units.

{{Convert}} uses unit-codes, which are similar to, but not necessarily exactly the same as, the usual written abbreviation for a given unit. These unit-codes are displayed in column 3 of the following tables. These are accepted as input by {{convert}} as the second and third unnamed parameters:

The unit-codes should be treated as case-sensitive:

The output of {{convert}} can display multiple converted units, if further unit-codes are specified after the second unnamed parameter (without the pipe separator). Typical combination output units are listed below in column 7.

Some units have alternative unit-codes. These are shown in brackets in column 3, e.g. °F (F). Either may be entered for Fahrenheit (but not a lower-case f).

Abridged list of supported units
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


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


DENSITY
system unit unit-
code
abbrev-
iation
notes sample default
conversion
combination
output units
Metric {{#ifeq:{Template:Br kg/m3 (none) {{#ifeq:{Template:Br
  • kg/m3 lb/ft3 (kg/m3 lb/cuft)
  • kg/m3 lb/yd3 (kg/m3 lb/cuyd)
{{#ifeq:{Template:Br g/m3 (none) {{#ifeq:{Template:Br
  • g/m3 kg/m3
  • g/m3 lb/ft3 (g/cm3 lb/cuft)
  • g/m3 lb/yd3 (g/cm3 lb/cuyd)
Imperial
&
US customary
{{#ifeq:{Template:Br lb/ft3 (none) {{#ifeq:{Template:Br
  • lb/ft3 kg/m3 (lb/cu ft g/m3)
  • lb/ft3 g/m3 (lb/cu ft g/m3)
{{#ifeq:{Template:Br lb/yd3 (none) {{#ifeq:{Template:Br
  • lb/yd3 kg/m3 (lb/cuyd kg/m3)
  • lb/yd3 g/m3 (lb/cuyd g/m3)


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


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


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


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


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


TEMPERATURE
(Full list)
system unit unit-
code
abbrev-
iation
notes sample default
conversion
combination
output units
SI {{#ifeq:{Template:Br K (none) Allows triple output units. See: full list. {{#ifeq:{Template:Br
  • K °C (K C)
  • K °R (K R)
  • K °F (K F)
{{#ifeq:{Template:Br °C (C) (none) {{#ifeq:{Template:Br
  • °C K (C K)
  • °C °R (C R)
  • °C °F (C F)
Imperial
&
US customary
{{#ifeq:{Template:Br °R (R) (none) {{#ifeq:{Template:Br
  • °R K (R K)
  • °R °C (R C)
  • °R °F (R F)
{{#ifeq:{Template:Br °F (F) (none) {{#ifeq:{Template:Br
  • °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: {{#ifeq:{Template:Br warmer
Fahrenheit change F-change Used for temperature intervals instead of actual temperatures
Example:  {{convert|10|F-change|0}} colder
Result: {{#ifeq:{Template:Br colder


TORQUE
(Full list)
system unit unit-
code
abbrev-
iation
notes sample default
conversion
combination
output units
Industrial
SI {{#ifeq:{Template:Br Nm (none) Triple combinations are also possible. See the full list. {{#ifeq:{Template:Br
  • Nm kg.m
  • Nm lb.ft
Non-SI metric {{#ifeq:{Template:Br kg.m (none) {{#ifeq:{Template:Br
  • kg.m Nm
  • kg.m lb.ft
Imperial
&
US customary
{{#ifeq:{Template:Br lb.ft (none) {{#ifeq:{Template:Br
  • lb.ft Nm
  • lb.ft kg-m
Scientific
SI {{#ifeq:{Template:Br N.m (none) Triple combinations are also possible. See the full list. {{#ifeq:{Template:Br
  • N.m kgf.m
  • N.m lbf.ft
Non-SI metric {{#ifeq:{Template:Br kgf.m (none) {{#ifeq:{Template:Br
  • kgf.m N.m
  • kgf.m lbf.ft
Imperial
&
US customary
{{#ifeq:{Template:Br lbf.ft (none) {{#ifeq:{Template:Br
  • lbf.ft N.m
  • lbf.ft kgf.m


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


PRESSURE
unit unit-
code
abbrev-
iation
sample default
conversion
{{#ifeq:{Template:Br GPa (none) {{#ifeq:{Template:Br
{{#ifeq:{Template:Br MPa (none) {{#ifeq:{Template:Br
{{#ifeq:{Template:Br kPa (none) {{#ifeq:{Template:Br
{{#ifeq:{Template:Br hPa (none) {{#ifeq:{Template:Br
{{#ifeq:{Template:Br Pa (none) {{#ifeq:{Template:Br
{{#ifeq:{Template:Br mPa (none) {{#ifeq:{Template:Br
{{#ifeq:{Template:Br mbar (none) {{#ifeq:{Template:Br
mb {{#ifeq:{Template:Br
{{#ifeq:{Template:Br dbar (none) {{#ifeq:{Template:Br
{{#ifeq:{Template:Br bar (none) {{#ifeq:{Template:Br
{{#ifeq:{Template:Br kBa (none) {{#ifeq:{Template:Br
{{#ifeq:{Template:Br Ba (none) {{#ifeq:{Template:Br
{{#ifeq:{Template:Br atm (none) {{#ifeq:{Template:Br
{{#ifeq:{Template:Br Torr (none) {{#ifeq:{Template:Br
{{#ifeq:{Template:Br mmHg (none) {{#ifeq:{Template:Br
{{#ifeq:{Template:Br inHg (none) {{#ifeq:{Template:Br
{{#ifeq:{Template:Br psi (none) {{#ifeq:{Template:Br
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).
POPULATION DENSITY
unit unit-
code
notes combinations
inhabitants per square kilometre PD/km2 PD stands for population density, i.e. humans (inhabitants)
  • PD/km2 PD/sqmi
per square kilometre /km2 Used when the word 'inhabitants' would be inappropriate.
  • /km2 /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/km2
per square mile /sqmi Used when the word 'inhabitants' would be inappropriate.
  • /sqmi /km2
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)

'per' units: kg/hl, miles per gallon

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

Population density (inhabitants per square mile) can be converted using

Vehicular fuel efficiency, commonly expressed in miles per gallon or litres per 100 km can also be converted

  • {{convert|26|mpgUS|l/100km mpgimp}} → {{#ifeq:{Template:Br

Units of difference: Expressing a change or difference in temperature

We have already discussed standard temperature conversions (°C, °F, K), as shown in these two examples:

  • {{convert|10|C}} → {{#ifeq:{Template:Br (standard temperature conversion)
  • {{convert|10–15|C}} → {{#ifeq:{Template:Br (standard temperature range conversion)

When expressing a temperature change (e.g., "The temperature increased by 10 °C"), or when comparing temperatures (e.g., "10 to 15 °C warmer"), we cannot use the standard temperature units (|C, |F and |K), which refer to points on the respective scale. Instead, we must use one of the following "units of difference": |C-change, |F-change and |K-change.

Compare the following two examples with the two above:

  • {{convert|10|C-change}} → {{#ifeq:{Template:Br increase in temperature
  • {{convert|10–15|C-change}} → {{#ifeq:{Template:Br warmer than normal

To produce multiple units in the output:

  • {{convert|10|C-change|F-change K-change}} → {{#ifeq:{Template:Br difference

Multiple units: 1 ft 5 in

In input

Base document § Input multiples lists options for multiple unit input (like ft,in). It can catch predefined sets only (units that can be subdivided; e.g., yd into ft):

In output

Available multiple-unit output options predefined, like ftin and ydftin. The full list is at § Output multiples.

  • {{convert|2|m|ftin}} → {{#ifeq:{Template:Br
  • {{convert|2|m|ft in}} → {{#ifeq:{Template:Br, using a space, returns the decimal point

Default behaviour, for comparison:

See also:

  • {{hands}} a length used to measure horses
  • {{Long ton}} a weight in ton, cwt, qr and lb

Currency per unit: $/mi → $/km

Using currency symbols in a $ per unit value, you can convert the per-unit:

You can set the currency in both values using |$=€:

  • {{convert|10|$/mi|$/km|$=€}} → {{#ifeq:{Template:Br

It is not possible to convert the currency. So, this result (mixed currencies) is not possible: $15 per mile (€8.6/km) Red XN

Using convert inside templates

For usage in template code, like infoboxes, {{Convert}} has these options:

Pre-formatting fraction input
Your template can accept |input=16 7/8 and use {{#invoke:Convert/helper|number|16 7/8}} → Script error: No such module "Convert/helper".
Using a Wikidata property
  • Adding the Wikidata property code, like code |input=P2073, to your template code automatically returns the Wikidata property for that article, and convert it. Both number and unit are read.

Note: to return that property value for an other article, use |qid=.

Example for (P2073): Note: this example uses |qid=Q1056131 (testing for (Q1056131))

  • {{convert|input=P2073|qid=Q1056131|ftin|abbr=on}} → {{#ifeq:{Template:Br
  • {{convert|input=P2073|qid=Q1056131|km|abbr=on}} → {{#ifeq:{Template:Br
  • {{convert|input=P2073|qid=Q1056131|km|abbr=on|disp=out}} → {{#ifeq:{Template:Br
For example see template:Infobox Telescope.

Sometimes a property may have more than one value against it in Wikidata. You can use the |qual= parameter to specify which of the values you want to use.

Example for (P2386): Note: this example uses |qid=Q1513315 (testing for (Q1513315))

Parameter list

Parameter Value Description Note
|abbr in Use symbol for first (left-hand side) unit Unit display
off Use name for all units Unit display
none
on Use symbol for all units Unit display
out Use symbol for right-hand side unit (default) Unit display
unit Use symbol for all units when using scientific notation Unit display
values Omit both the input and output units: show only the numbers Unit display
~ Shows both unit name and symbol Unit display
mid User-specified text after the input unit; sets adj=on (adjective). Expects 1 unnamed parameter. Word adding, adjective
on Unit name is adjective (singular and hyphenated) Grammar, adjective
pre User-specified text before input unit. Expects 1 unnamed parameter. Word adding
ri0 Round input with precision 0 Input precision
ri1 Round input with precision 1 Input precision
ri2 Round input with precision 2 Input precision
ri3 Round input with precision 3 Input precision
|comma 5 Only use comma for thousands separator if 5 or more digits Number format
gaps Use gaps (space), not comma, for thousands separator Number format
off No thousands separator Number format
|disp b Join input and output using " (...)" (default) Join values
sqbr Join input and output using " [...]" Join values
br Join input and output using "<br/>" Join values
comma Join input and output using ", " Join values
or Join input and output using " or " Join values
number Display output number only Parts only
output number only
out Display only output number and name/symbol Parts only
output only
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
table Output is suitable for a table cell with align="right" Table columns
tablecen Output is suitable for a table cell with align="center" Table columns
unit Display input name/symbol only (not input number, not output) Parts only
unit2 Display output name/symbol only (not input; not output number) Parts only
x Join input and output using user-specified text Word adding
|frac N Show imperial number in fractions, denominator=N Number format, fraction
|input P2048 (e.g.) Reads and converts Wikidata property Inside template
|lk in Link left-hand side unit name or symbol Unit link
on Link all unit names or symbols (but not twice for the same unit) Unit link
out Link right-hand side unit name or symbol Unit link
|order flip Inverts order of input, output measurements (conversion first) Order
out Displays output units in the order entered, skipping input unit Order
|qid Q1056131 (e.g.) Reads Wikidata property from Wikidata item Inside template; testing
|qual Q613628 (e.g.) Qualify Wikidata property
|round 5 Rounds calculation to the nearest multiple of 5 Output precision
25 Rounds calculation to the nearest multiple of 25 Output precision
each In a range, each number is rounded by the default rounding Output precision
|sigfig N Round output number to N significant figures (N is a positive integer) Output precision
|sortable on Adds invisible sort key Table sort
|sp us Use U.S. spelling ("meter" instead of default "metre") Spelling U.S. names
|spell in Spell input number in words Spelling numbers
In Spell input number in words with first letter uppercase Spelling numbers
on Spell input and output numbers in words Spelling numbers
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 Debugging only. In a sortable table: show the normally hidden sort key Table sort
|disp flip Deprecated. Use |order=flip Order
|sing= Deprecated. Use |adj= Plurals

Deprecated options

This list: 

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 MOS compliant). Use |x| instead
  • Range separator |*| is deprecated (not MOS compliant). Use |x| instead

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for this template in articles based on this TemplateData.

TemplateData for Convert

Converts measurements to other units.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Value1

The value to convert.

Numberrequired
From unit2

The unit for the provided value.

Example
km
Stringrequired
To units3

The units to convert into. Separate units by a space for multiple outputs. In an output unit, use + for a multiplication space.

Example
mi nmi
Stringsuggested
Precision or suffix4

Significant digits after decimal dot or, if negative, exponent of ten.

Numberoptional
Link unitslk

Indication of what units to apply wikilinks to. Use “on” for all, “in” for the input unit, “out” for the output units, or “off” for none of the units.

Default
off
Example
on
Stringoptional
Abbreviationabbr

Display for the units: “on” to display all units using their unit symbols, “off” to display all units in full words, “in” to display the unit symbol for the input unit, “out” to display the unit symbols for the output units, “unit” to display unit symbols for both input and output units when using scientific notation, “values” for no units at all (neither unit symbols nor full words of units).

Default
out
Example
on, unit, in, out, off
Stringsuggested
Spellingsp

Spelling of units. Use “us” to display unit names using U.S. spelling.

Example
us
Stringoptional
Adjectiveadj

Whether to use adjectival form. Use “on” for singular unit name appended by a hyphen, “mid” to put conversion at end, or “off” (default) for no adjectival form.

Default
off
Example
on
Unbalanced wikitextoptional
Conversiondisp

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.

Example
b
Stringoptional
Orderingorder

“flip” returns converted value first, input value second.

Example
flip
Stringoptional
Significant figuressigfig

Indicates the number of significant figures to be used in rounding.

Numberoptional
Rounding outputround

The type of rounding. “5” rounds the output number to nearest multiple of 5, “25” to nearest multiple of 25, “each” rounds each number in a range.

Numberoptional
Thousands separatorcomma

Sets or suppresses the use of thousands separators in the numbers. “off”: no separator; “gaps”: use space instead of comma as thousands separator; “5”: only add thousands separator when the integral part of the number uses 5 positions or more (10,000 or more; if using comma as thousands separator, 1234 would produce '1234', 12345 would produce '12,345').

Default
on
Example
off
Stringoptional
Sort keysortable

“on” generates a hidden sort key

Example
on
Stringoptional
Spell numbers?spell

If used, spells input or input and output numbers in words, optionally capitalizing the first

Example
'in', 'In', 'on', or 'On'
Stringoptional
Singular?sing

If 'yes', uses singular form of units (deprecated)

Example
yes
Stringdeprecated
Fraction?frac

fraction as rounding unit

Numberoptional
Currency symbol$

sets currency symbol in both units

Example
$=€ will show " €10 per mile (€6.2/km)"
Stringoptional
WD propertyinput

Reads the property value of the item (article), then converts it

Example
{{convert|input=P2046}} (P2046=area)
Stringoptional

See also