Template:Convert
The available units are listed here. Note that units are case-sensitive!
Usage
This template calculates measurements from one unit (you can enter) to another one, and then presents the results. For example:
{{convert|2|km|mi}}
→ 2 kilometres (1.2 mi){{convert|7|mi|km}}
→ 7 miles (11 km)
You can also round the result. Using round=5 for example, rounds the outcome to a multiple of 5.
{{convert|10|m|ft}}
→ 10 metres (33 ft){{convert|10|m|ft|round=5}}
→ 10 metres (35 ft)
In a range, one can round each value individually to the default. Use round=each:
{{convert|10 x 200 x 3000|m|ft}}
→ 10 by 200 by 3,000 metres (33 × 656 × 9,843 ft){{convert|10 x 200 x 3000|m|ft|round=each}}
→ 10 by 200 by 3,000 metres (33 × 660 × 9,800 ft)
Rounding to fractions is also possible. Specify the desired denominator using frac=<some positive integer>.
{{convert|5.56|cm|in|frac=16}}
→ 5.56 centimetres (2 3⁄16 in){{convert|8|cm|in|frac=4}}
→ 8 centimetres (3 1⁄4 in)
The fraction is reduced when possible:
{{convert|8|cm|in|frac=100}}
→ 8 centimetres (3 3⁄20 in){{convert|8|cm|in}}
→ 8 centimetres (3.150 in) (To compare)
While it is possible to enter feet, inch in a simple conversion, this is not possible for ranges:
{{convert|1|ft|3|in|mm}}
→ 1 foot 3 inches (380 mm) (to compare){{convert|1|ft|3|in|x|3|ft|5|in|mm}}
→ 1 foot 3 inches ([convert: unknown unit])
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:
{{convert|1234567|m|ft}}
→ 1,234,567 metres (4,050,417 ft){{convert|1,234,567|m|ft}}
→ 1,234,567 metres (4,050,417 ft){{convert|1 234 567|m|ft}}
→ [convert: invalid number]
It is also possible to change the way the two measurements are distinguished from one another. Options are: b
(the default), sqbr
, comma
, or
, br
, x|...
:
{{convert|10|m|ft}}
→ 10 metres (33 ft)—( ) brackets are the default{{convert|10|m|ft|disp=sqbr}}
→ 10 metres [33 ft]{{convert|10|m|ft|disp=comma}}
→ 10 metres, 33 ft{{convert|10|m|ft|disp=or}}
→ 10 metres or 33 feet
Setting |disp=br
will force a new line (<br>
)
{{convert|10|m|ft|disp=br}}
→ 10 metres
33 feet
Also |disp=br()
will force a new line, and keep the brackets:
{{convert|10|m|ft|disp=br()}}
→ 10 metres
(33 feet)
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}}
→ {{nowrap|1=<span style="display:none">7001100000000000000</span>10 metres (33 ft)}