مساعدة:Convert units

قالب:Wikipedia how to Template {{convert}} is used to convert a value from one unit of measurement to another. This page documents some features of units, and lists units that are commonly used in conversions.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Default output

If no output unit is specified, the default output for the input unit will be used. Using defaults provides greater uniformity across articles.

Some options provide text that the template may mistakenly use for the output unit, if none is specified. That can be avoided by providing an empty output unit, as shown in the following examples.

  • {{convert|4|ft}} → 4 feet (1.2 m)
  • {{convert|4|ft|adj=mid|-long}} → 4-foot ([convert: unknown unit])
  • {{convert|4|ft||adj=mid|-long}} → 4-foot-long (1.2 m)

The second of the above examples produces an error because "-long" is interpreted as the name of the output unit. The third example avoids that by specifying an empty output unit which means "use the default".

The following also works, although it sets the output precision to 0.

  • {{convert|4|ft|0|adj=mid|-long}} → 4-foot-long (1 m)

The last example works because "|0" sets the output precision to zero, and convert does not look for an output unit once the precision has been specified because a precision is always given after the output unit, if any.


SI prefixes

The standard SI prefixes can applied to the following units. قالب:Sidebar metric prefixes

Unit type Unit code Unit name
Area a are
m2 square metre
Charge coulomb coulomb
Energy J joule
Force N newton
Length m metre
Magnetic field strength T tesla
Mass g gram
Power W watt
Pressure Pa pascal
Radioactivity Bq becquerel
Ci curie
Time s second
Volume L litre
l litre
m3 cubic metre

Some SI prefixes are demonstrated in the following. As a convenience, "micro" can be entered as "u" instead of "µ".

  • {{convert|1.23|Gm|angstrom}} → 1.23 gigametres (1.23×1019 Å)
  • {{convert|1.23|Mm|angstrom}} → 1.23 megametres (1.23×1016 Å)
  • {{convert|1.23|Ts|hour}} → 1.23 teraseconds (340,000,000 h)
  • {{convert|1.23|nJ|Wh}} → 1.23 nanojoules (3.4×10−13 Wh)
  • {{convert|1.23|µm|in}} → 1.23 micrometres (4.8×10−5 in)
  • {{convert|1.23|um|in}} → 1.23 micrometres (4.8×10−5 in)
  • {{convert|1.23|um|uin|abbr=on}} → 1.23 μm (48 μin)
  • {{convert|18|mm|in}} → 18 millimetres (0.71 in)
  • {{convert|18|km|mi}} → 18 kilometres (11 mi)

The above demonstrates that "uin" is the unit code for microinch.

Combinations

An input unit can be converted to any number of output units—the outputs are specified as a "combination" by separating unit codes with a space (" ") or a plus ("+"). Using a space as a separator does not work if any of the unit codes contains a space.

For example, each of the following converts 1.2 km2 to acres, square yards, and hectares.

  • {{convert|1.2|km2|acre sqyd ha}} → 1.2 square kilometres (300 acres; 1,400,000 sq yd; 120 ha)
  • {{convert|1.2|km2|acre+sqyd+ha}} → 1.2 square kilometres (300 acres; 1,400,000 sq yd; 120 ha)

In the following, because "board feet" contains a space, using a space to make a combination fails.

  • {{convert|123|cuyd|m3 board feet}} → 123 cubic yards ([convert: unknown unit])
  • {{convert|123|cuyd|m3+board feet}} → 123 cubic yards (94 m3; 40,000 board feet)

The following converts a pressure to four output units. The precision is 1 (1 decimal place), and units are abbreviated and linked.

  • {{convert|895|hPa|psi inHg atm mbar|1|abbr=on|lk=on}} → 895 hPa (13.0 psi; 26.4 inHg; 0.9 atm; 895.0 mbar)

Some "standard" combinations have been defined—see the full list of units.

Engineering notation

Most units can be combined with a scale factor, for example, e6km represents a million kilometres. The following prefixes may be used; per WP:NUMERAL, values follow the short scale. If lk is on, the numbers are linked as shown below.

Engineering notation can only be applied to simple units—temperatures, combinations, and some other special units will not work.

Some examples using engineering notation follow.

  • {{convert|123.4|e3m2}} → 123.4 thousand square metres (1.328×10^6 sq ft)
  • {{convert|123.4|e3m2|e6sqft|abbr=off}} → 123.4 thousand square metres (1.328 million square feet)
  • {{convert|1.23|e6L}} → 1.23 million litres (320,000 US gal)
  • {{convert|1.23|e6L|e3usgal|abbr=off|lk=on|sp=us}} → 1.23 million liters (320 thousand U.S. gallons)
  • {{convert|1.23|e9impgal}} → 1.23 billion imperial gallons (5.6 Gl)
  • {{convert|1.23|e9impgal|e3usgal|abbr=off|lk=on}} → 1.23 billion imperial gallons (1,480,000 thousand US gallons)
  • {{convert|1.23|e12cuft}} → 1.23 trillion cubic feet (35×10^9 m3)

Units

خطأ: لا توجد وحدة بهذا الاسم "convert/show".

Hands (unit of length)

A hand is a unit of length used to measure the height of horses. One hand is four inches, and a value of 12.3 hands represents 12 hands + 3 inches (51 inches).

Output name

  • By default, the unit is shown as a linked name (hands).
  • The hands unit can be abbreviated to "h" or to "hh"; by default, abbreviations are not linked.
    {{convert|27|in|hand}} → 27 inches (6.3 hands)
    {{convert|27|in|hand|lk=off}} → 27 inches (6.3 hands)
    {{convert|27|in|hand|abbr=h}} → 27 in (6.3 h)
    {{convert|27|in|hand|abbr=hh}} → 27 in (6.3 hh)
    {{convert|27|in|hand|abbr=hh|lk=out}} → 27 in (6.3 hh)

Output value

  • The hands value has at most one digit after the decimal mark, and has an optional fraction.
  • A precision of 2 assumes |frac=2 (round to nearest 12 inch).
  • A precision of 3 or more assumes |frac=4 (round to nearest 14 inch).
  • If ever needed, |frac=8 can be used to round to the nearest 18 inch.
    {{convert|27.63|in|hand}} → 27.63 inches (7.0 hands)
    {{convert|27.63|in|hand|0}} → 27.63 inches (7 hands)
    {{convert|27.63|in|hand|1}} → 27.63 inches (7.0 hands)
    {{convert|27.63|in|hand|2}}27.63 inches (6.3+12 hands)
    {{convert|27.63|in|hand|3}}27.63 inches (6.3+34 hands)
    {{convert|27.63|in|hand|frac=8}}27.63 inches (6.3+58 hands)
    {{convert|28.5|in|hand|2}}28.5 inches (7.0+12 hands)
    {{convert|28.5|in|hand|3}}28.5 inches (7.0+12 hands)

Output in hands and inches

  • When using "hand in" to convert to hands and inches, the rounded hands and inches values are equivalent, and use the same fraction, if any.
  • Special rounding of the inches value only occurs when "hand in" is the output. For example, if the output is "in hand", the inches value is rounded independently from the hands value.
    {{convert|156|cm|hand in}} → 156 centimetres (15.1 hands; 61 in)
    {{convert|156|cm|hand in|2}}156 centimetres (15.1+12 hands; 61+12 in)
    {{convert|156|cm|in hand}} → 156 centimetres (61 in; 15.1 hands)
    {{convert|156|cm|in hand|2}}156 centimetres (61.42 in; 15.1+12 hands)
    {{convert|156|cm|hand in|abbr=out}} → 156 centimetres (15.1 h; 61 in)
    {{convert|156|cm|hand in|abbr=h}} → 156 cm (15.1 h; 61 in)
    {{convert|156|cm|hand in|abbr=hh}} → 156 cm (15.1 hh; 61 in)

Ranges

  • A range of values can be indicated with "-" (hyphen) or "to". When a dash is displayed by convert, it is always an en dash.
  • Alternatively, "and" and "or" can be used.
    {{convert|137|-|156|cm|hand in}} → 137–156 centimetres (13.2–15.1 hands; 54–61 in)
    {{convert|137|-|156|cm|hand in|2}}137–156 centimetres (13.2–15.1+12 hands; 54–61+12 in)
    {{convert|137|-|156|cm|hand in|abbr=in}} → 137–156 cm (13.2–15.1 hands; 54–61 inches)
    {{convert|137|-|156|cm|hand in|abbr=h}} → 137–156 cm (13.2–15.1 h; 54–61 in)
    {{convert|137|-|156|cm|hand in|abbr=on}} → 137–156 cm (13.2–15.1 h; 54–61 in)
    {{convert|137|and|156|cm|hand in|abbr=on}} → 137 and 156 cm (13.2 and 15.1 h; 54 and 61 in)
    {{convert|137|or|156|cm|hand in|abbr=on}} → 137 or 156 cm (13.2 or 15.1 h; 54 or 61 in)


. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Examples

  • The following examples illustrate various combinations of options.
    {{convert|57|in|hand}} → 57 inches (14.1 hands)
    {{convert|2|m|hand}} → 2 metres (19.3 hands)
    {{convert|137|cm|hand|2}} → 137 centimetres (13.2 hands)
    {{convert|137|cm|hand|2|sp=us}} → 137 centimeters (13.2 hands)
    {{convert|14.1|hand|in}} → 14.1 hands (57 inches)
    {{convert|14.1|hand|cm}} → 14.1 hands (145 cm)
    {{convert|14.1|hand|in cm}} → 14.1 hands (57 inches; 145 cm)
    {{convert|14.1|hand|cm in}} → 14.1 hands (145 cm; 57 inches)
    {{convert|14.1|-|14.3|hand|cm}} → 14.1–14.3 hands (145–150 cm)
    {{convert|14.1|-|14.3|hand|in cm}} → 14.1–14.3 hands (57–59 inches; 145–150 cm)
    {{convert|50|-|57|in|hand}} → 50–57 inches (12.2–14.1 hands)
    {{convert|2|-|3|m|hand}} → 2–3 metres (19.3–29.2 hands)
    {{convert|57|or|59|in|hand|abbr=on}} → 57 or 59 in (14.1 or 14.3 h)
    {{convert|137|-|139|cm|hand|lk=on}} → 137–139 centimetres (13.2–13.3 hands)
    {{convert|137|and|162|cm|hand|0|abbr=in|lk=in}} → 137 and 162 cm (13 and 16 hands)
    {{convert|137|and|162|cm|hand in}} → 137 and 162 centimetres (13.2 and 16.0 hands; 54 and 64 in)
    {{convert|9.2|hand}} → 9.2 hands (38 inches; 97 cm)
    {{convert|9.2|hand|lk=off}} → 9.2 hands (38 inches; 97 cm)
    {{convert|9.2|hand|abbr=h}} → 9.2 h (38 in; 97 cm)
    {{convert|9.2|hand|abbr=h|lk=in}} → 9.2 h (38 in; 97 cm)
    {{convert|9.2|hand|abbr=hh|lk=in}} → 9.2 hh (38 in; 97 cm)
    {{convert|9.2+1/2|hand}}9.2+12 hands (38.5 inches; 98 cm)
    {{convert|9.2+3/4|hand}}9.2+34 hands (38.75 inches; 98 cm)
    {{convert|9.2+3/4|hand|abbr=h}}9.2+34 h (38.75 in; 98 cm)
    {{convert|9.2+3/4|hand|cm in}}9.2+34 hands (98 cm; 38.75 inches)
    {{convert|9.2+3/4|hand|cm in|abbr=out}}9.2+34 hands (98 cm; 38.75 in)
    {{convert|9.2+3/4|hand|cm in|abbr=on}}9.2+34 h (98 cm; 38.75 in)
    {{convert|9.2+3/4|hand|in}}9.2+34 hands (38.75 inches)
    {{convert|9.2+3/4|hand|in|abbr=out}}9.2+34 hands (38.75 in)
    {{convert|9.2+3/4|hand|in|abbr=on}}9.2+34 h (38.75 in)
    {{convert|15.1|-|16.3|hand}} → 15.1–16.3 hands (61–67 inches; 155–170 cm)
    {{convert|14.2|to|16.1|hand}} → 14.2 to 16.1 hands (58 to 65 inches; 147 to 165 cm)