Template: Convert/doc
From New World Encyclopedia
Examples of how to use the Convert template
Basic input and variable parameters
In order to . . . | add this parameter | text / code to enter | It will look like |
convert feet to meters | {{convert|100|ft}} OR {{convert|100|ft|m}} |
100 feet (30 m) | |
convert metres to feet | {{convert|100|m}} | 100 meters (330 ft) | |
Produce US spellings | sp=us | {{convert|100|m|sp=us}} | 100 meters (330 ft) |
Abbreviate the initial unit | abbr=on | {{convert|100|m|abbr=on}} | 100 m (330 ft) |
Hyphenate the initial unit | adj=on | {{convert|100|ft|adj=on}} | 100-foot (30 m) |
Produce a conversion rounded to
|
sigfig=3 | {{convert|100|ft|sigfig=3}} | 100 feet (30.5 m) |
Produce a conversion rounded to
|
sigfig=4 | {{convert|100|ft|sigfig=4}} | 100 feet (30.48 m) |
Round to
|
0 | {{convert|100|ft|0}} | 100 feet (30 m) |
Round to
|
1 | {{convert|100|ft|1}} | 100 feet (30.5 m) |
Round to
|
2 | {{convert|100|ft|2}} | 100 feet (30.48 m) |
Standard format for a single value conversion
{{convert|original_value|original_unit|conversion_unit|round_to|...}}
Standard format for converting a range of values
{{convert|orig_val1|range|orig_val2|original_unit|conversion_unit|round_to|...}}
Partial list of possible values that can be used
original_value | original_unit and conversion_unit
|
range | round_to | other options (add with a | (pipe)) |
any number (no commas; hyphen for negative values) |
km, m, cm, mm, mi, yd, ft, in, km2, m2, cm2, mm2, sqmi, sqft, sqin, km3, m3, cc, l, cl, ml, cuft, cuin, USgal, USqt, USpt, USoz, m/s, km/h, mph, ft/s, kn (knot), °C, °F, kg, g, mg, lb, oz, MT (metric ton) LT (long ton), ST (short ton) | and, to, -, by, ± |
0, 1, 2, 3, sigfig=2 sigfig=3 sigfig=4 . . . |
sp=us, abbr=on, adj=on |
Sample inputs for units of length
If you want to convert . . . | text / code to enter | It will look like | Notes |
feet to meters | {{convert|100|ft}} | 100 feet (30 m) | The default conversion for feet is m. |
meters to feet | {{convert|100|m}} | 100 meters (330 ft) | Default spelling is metres. |
meters to feet (US spelling) | {{convert|100|m|sp=US}} | 100 meters (330 ft) | (add sp=us parameter) |
feet to meters (hyphenated
|
{{convert|100|ft|adj=on}} | 100-foot (30 m) | (add adj=on parameter) |
feet to meters (abbreviated
|
{{convert|100|ft|abbr=on}} | 100 ft (30 m) | (add abbr=on parameter) |
inches to millimeters | {{convert|10|in}} | 10 inches (250 mm) | The default conversion for inches is mm |
inches to centimeters | {{convert|10|in|cm}} | 10 inches (25 cm) | Add the cm parameter, if you don't want the result in mm. |
miles to kilometers | {{convert|10|mi}} | 10 miles (16 km) | |
kilometres to miles | {{convert|10|km}} | 10 kilometers (6.2 mi) | |
kilometers to miles
|
{{convert|10|km|sp=us}} | 10 kilometers (6.2 mi) | (add sp=us parameter) |
kilometers to miles
|
{{convert|10|km|abbr=on}} | 10 km (6.2 mi) | (add abbr=on parameter) |
Sample inputs for units of area
If you want to convert . . . | text / code to enter | It will look like | Notes |
square km to square mi | {{convert|100|km2}} | 100 square kilometers (39 sq mi) | |
square mi to square km | {{convert|100|sqmi}} | 100 square miles (260 km²) | |
square m to square ft | {{convert|100|m2}} | 100 square meters (1,100 sq ft) | |
square ft to square m | {{convert|100|sqft}} | 100 square feet (9.3 m²) | |
square cm to square in | {{convert|100|cm2}} | 100 square centimeters (16 sq in) | |
square in to square cm | {{convert|100|sqin}} | 100 square inches (650 cm²) |
Further Information
- More details are available at Wikipedia's corresponding page:
Converting a range of values
If you want to convert . . . | text / code to enter | It will look like | Notes |
30 x 50 square km to sq mi. | {{convert|30|by|50|km2|mi2|3}} | 30 by 50 square kilometers (11.583 sq mi × 19.305 sq mi) | the 3 yields 3 decimal points |
360 x 160 ft | {{convert|360|by|160|ft|1}} | 360 by 160 feet (109.7 m × 48.8 m) | the 1 yields 1 decimal point |
50 to 80 pounds to kg | {{convert|50|-|80|lb|kg}} | 50–80 pounds (22.7–36.3 kg) |