|
| Template:Convert ispermanentlyprotected from editing as it is aheavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported byconsensus, editors may use {{edit template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template'sdocumentation to add usage notes orcategories. Any contributor may edit the template'ssandbox. Functionality of the template can be checked usingtest cases. |
Archives | |||
| |||
This page has archives. Sections older than90 days may be auto-archived byLowercase sigmabot III if there are more than 2. |
| Related pages |
|---|
Wasn't there a way to convert2 × 4 s lumber boards?--Carnby (talk)20:12, 27 July 2025 (UTC)[reply]
{{convert|1|board foot|cuin|0}} → 1 board foot (144 cu in){{convert|12|board foot|cuft}} → 12 board foot (1.0 cu ft){{nowrap|2 × 3 s}} ({{cvt|1+1/2|x|2+1/2|in|mm|disp=comma}}) or {{nowrap|2 × 4 s}} ({{cvt|1+1/2|x|3+1/2|in|mm|disp=comma}}) yielding2 × 3 s (1+1⁄2 in × 2+1⁄2 in, 38 mm × 64 mm) or2 × 4 s (1+1⁄2 in × 3+1⁄2 in, 38 mm × 89 mm).--Carnby (talk)05:30, 28 July 2025 (UTC)[reply]
Village Pump referred me here. Have run into this issue on several articles, one example occurring in the lead forChula, Virginia (at least with the screen resolution that I'm using): Is there a way to force the template to put a nonbreaking space between numeral and units displayed in the article text, so as to reliably generate "7 miles (11 km)"? A single good example of the correct syntax might suffice. —HelpMyUnbelief (talk)00:14, 5 August 2025 (UTC)[reply]
{{convert|2|mi|km|disp=preunit| }} → 2 miles (3.2 km)—HelpMyUnbelief (talk)05:52, 5 August 2025 (UTC)[reply]The area is served by the post office 7
miles (11 km) southwest.
Stepho talk 06:23, 5 August 2025 (UTC)[reply]The man was John
Doe from the United
States. He lived 7
miles out of town.
It is desirable to prevent line breaks where breaking across lines might be confusing or awkward.The first example provided by that guideline is
19 kg. The guideline also provides a good case where{{convert}} might be used but preventing a break is undesirable, specifically tables, since horizontal space is precious. –Daℤyzzos (✉️ • 📤)10:00, 5 August 2025 (UTC)[reply]
19 kg but a space in19 kilograms because that is whatMOS:UNITNAMES specifies. Thanks Quondum for pointing out that there is no "Wrapping and line breaking" section atHelp:Convert despite there being a link to it atTemplate:Convert#Wrapping and line breaking. It turns out that I removed the section. The original is atOctober 2023. I hoped Help:Convert would focus on common usage examples—how do you doX. But people started expanding the docs here (Template:Convert/doc), then moved stuff to Help:Convert when this page became too bloated. I don't think there is anything in the section I removed that should be retained because it can be summed up as "convert follows MOS". The details bloat whatever page they are on. If someone wants to restore it, please put it here rather than using Help:Convert as an overflow page. Or maybe make another doc page for techo details.Johnuniq (talk)03:50, 6 August 2025 (UTC)[reply]Guidance on the use of non-breaking spaces ("hard spaces") is given in some sections below, but not all situations in which hard spaces ( or ) or{{{1}}} may be appropriate are describedwas added (by me, I think). It has long been my intent to add specific guidance at each point in MOSNUM it's needed, but every time I think of actually doing that I get a headache.EEng15:38, 8 September 2025 (UTC)[reply]
I propose a change to the first sentence of "Limitations".
Instead of this:
This is a list of features that the module may be expected to support, but which will not work.
I recommend this:
The following strategies may seem right for this module, but they will not work.
I think "a list of features" is exactly the wrong thing to say - isn't it really a list of non-features, but ones that people are likely to try anyway?
TooManyFingers (talk)05:26, 30 August 2025 (UTC)[reply]
So I just found that{{cvt|5|hectares}} does’t work which is weird because{{cvt|5|acres}} does. So I would love to get that alias setup. I believe all that is needed is to insert the snippet below at line 326 onModule:Convert/data.
["hectares"]={target="hectare",},
Any objection to me adding this?Zackmann (Talk to me/What I been doing)01:16, 11 September 2025 (UTC)[reply]
Is there a way that I’m not seeing to only have the units printed one time when displaying 3 unit measurements? For example:
{{cvt|3 x 5 x 6|in|cm}} → 3 in × 5 in × 6 in (7.6 cm × 12.7 cm × 15.2 cm)What I was hoping to achieve is:
{{cvt|3 x 5 x 6|in|cm}} → 3 × 5 × 6 in (7.6 × 12.7 × 15.2 cm)Am I missing something? I’ve looked though the documentation pretty thoroughly… —Zackmann (Talk to me/What I been doing)07:33, 16 September 2025 (UTC)[reply]
{{cvt|3xx4xx5|in|cm}} and it does what I want! Is that documented anywhere?! —Zackmann (Talk to me/What I been doing)08:00, 16 September 2025 (UTC)[reply]x implements. (I seem to recall some recent MOS discussions where quite a few people suggested that should be relaxed?) I retainedxx in convert as a workaround for the occasional cases where the MOS guideline may not give a good result.Johnuniq (talk)08:51, 16 September 2025 (UTC)[reply]How irritating. Another retained but not-standard range is*. I faced a lot of pushback for keeping* andxx and it appears that somewhere the documentation atHelp:Convert was "fixed" to remove what were considered to be deprecated features. I think I must have restoredxx to Help:Convert but failed on*. Using* gives no spacing:
{{convert|3|*|6|ft}} → 3×6 feet (0.91×1.83 m)Johnuniq (talk)09:04, 16 September 2025 (UTC)[reply]
An RfC regardingTmcft is atWT:Manual of Style/Dates and numbers#RfC Tmcft in convert template? while previous discussions are atWT:Manual of Style/Dates and numbers/Archive 163#Tmcft andTemplate talk:Convert/Archive 3#Tmcft. The discussions are all over the place with no agreement that I can see. As a trial, I have put unitstmcft andTmcft inModule:Convert/extra. The other units in the following table already existed.
| Code | Symbol | Name |
|---|---|---|
| tmcft | tmcft | tmcft |
| Tmcft | tmcft | thousand million cubic feet |
| Bcuft | billion cu ft | billion cubic feet |
| Gcuft | ×10 | billion cubic feet |
Examples:
{{convert|178.74|tmcft}} → 178.74 tmcft (5.061 km3){{convert|178.74|tmcft|lk=in}} → 178.74tmcft (5.061 km3){{convert|178.74|Tmcft}} → 178.74 thousand million cubic feet (5.061 km3){{convert|178.74|tmcft|abbr=on|lk=out|order=flip}} → 5.061 km3 (178.74 tmcft){{convert|178.74|Tmcft|abbr=in|order=flip}} → 5.061 km3 (178.74 thousand million cubic feet){{convert|178.74|Tmcft|abbr=on|order=flip}} → 5.061 km3 (178.74 tmcft){{convert|123|Bcuft|km3}} → 123 billion cubic feet (3.5 km3){{convert|123|Bcuft|km3|abbr=on}} → 123 billion cu ft (3.5 km3){{convert|123|Gcuft|km3|abbr=on}} → 123×10Johnuniq (talk)06:47, 22 September 2025 (UTC)[reply]
Is it possible to have the unit of measure link similar to the “US$” wikilink inTemplate:US$? Could be useful for uncommon measure units likefrequencies (Hz, MHz, GHz, etc). —TadgStirkland401(TadgTalk-Email)01:59, 26 September 2025 (UTC)[reply]
I am planning to release a new version soon. The motivation is to introduce parametererror=x which means that convert would either work (anderror=x would have no effect), or would displayx instead of the usual convert error. I want this for at least one infobox (Template:Infobox food) which calls convert with text that is often a number, but which can be anything. For example, the infobox might call{{convert|123|kcal}} (which would work), or it might call{{convert|123 (per biscuit)|kcal}} (which would cause convert to return an error which the infobox would hide using#iferror). In the latter case, convert callsModule:Convert/extra to determine if the extraneous text is an "extra" unit. That means that many of the "what links here" entries for that module are false hits. I periodically check that list to see what problems have occurred, and to see what units defined in the extra module are being used.
Using the new parameter, the infobox would not need#iferror. Instead, it would call{{convert|123 (per biscuit)|kcal|error=123 (per biscuit)}} which would display "123 (per biscuit)
" instead of an error. The change is in the sandbox, examples:
{{convert/sandbox|123|kcal|error=123}} → 123 kilocalories (510 kJ){{convert/sandbox|123 (per biscuit)|kcal|error=123 (per biscuit)}} → 123 (per biscuit)Another minor change in the module is for projects that use variable names where the unit name can vary depending on the value. At ukwiki, they want a fraction slash to be detected as an alternative to a plain slash when used in a value with a fraction (such as1+3/4). The name of a unit can be different if a fractional value is used.
TheOctober 2024 release changed unitsmile andmiles to includeabbr=off on the principle that if someone wants to display the symbol "mi", they can use that as the input. If "mile" is used, the wanted output is probably "mile" or "miles". Any thoughts on doing the same for the following?
Unit foot is not in that list because it has a special purpose, namely its plural form is "foot", not "feet". The singular form is currently "1 ft" if abbreviated. That could be changed to "1 foot". Thoughts?Johnuniq (talk)07:23, 2 October 2025 (UTC)[reply]
Following the discussion atTemplate talk:Convert#Plans for new version just above, I have updated the module. The changes are:
error=x is new. The valuex is any text which may be empty. If no error occurs in the conversion, this option has no effect. Otherwise, the result isx (no error occurs).1+3/4).Theerror=x option will be tried at{{Infobox food}} to replace:
{{#iferror:{{convert|{{{calories|}}}|kcal}}|{{{calories|}}}|{{convert|{{{calories|}}}|kcal|lk=on|abbr=on}}}}with:
{{convert|{{{calories|}}}|kcal|lk=on|abbr=on|error={{{calories|}}}}}The result of the convert will be displayed if the conversion is successful. Otherwise, thecalories value entered in the infobox will be displayed.
The following examples use fixed wikitext so the outputs won't change in the future.
{{convert|123|kcal|error=This text has no effect because the conversion works.}} → 123 kilocalories (510 kJ){{convert|123 calories (per biscuit)|kcal|error=This text is displayed instead of an error.}} → This text is displayed instead of an error.{{convert|123 calories (per biscuit)|kcal|error=}} →(nothing is displayed)Johnuniq (talk)07:17, 5 October 2025 (UTC)[reply]
Hello all, I am trying to convert from grams to grains for the biathlon wikipedia page since the governing body uses grams for bullet weight but manufactures use grains. I don't see a grain option. Am I missing something?Jboy Hanny (talk)16:35, 12 October 2025 (UTC)[reply]
{{convert|1|g|gr}} → 1 gram (15 gr) and{{convert|1|gr|order=flip}} → 0.065 grams (1 gr) seem OK here.NebY (talk)16:43, 12 October 2025 (UTC)[reply]{{convert|1|grain|g}} → 1 grain (0.065 g). --Redrose64 🌹 (talk)21:23, 12 October 2025 (UTC)[reply]I've checked as much of the conversion template documents as I can find, and maybe I missed it. But, I'm trying to express the sensitivity of someradio frequency receiver systems, but the use of this conversion could easily apply as well to RF transmission systems. Typically, measurements of RF power (received or transmitted) are expressed in eitherdBm or some value ofwatts. Typically, as shown indBm § Table of examples, the two figures can often be found within the same document.
Am I (again) just dense, and the functionality already exists in the template, or would this need new separate code-work to be implemented? If the latter, I'd like to suggest a very wide set of available conversion factors. Some receivers work below −150 dBm, while some transmitters work in themegawatt range (see what I did there?). —TadgStirkland401(TadgTalk-Email)02:50, 20 October 2025 (UTC)[reply]
As title states, sometimes we'll encounter texts with frequent references to very high, GigaPascal levels of pressure (likethis one on metallic hydrogen), of which a conversion to atmospheric pressure usually consists of bunch of zeros.It might be a good idea to have some multiples of atm / bar to convert to, so the numbers wouldn't hinder one's reading of the text. I suggested MBar simply because it's a unit somewhat frequently used in literature. iris 7:39 (utc+8), edited 7:56海盐沙冰 / aka irisChronomia / Talk07:39, 22 October 2025 (UTC)[reply]
{{convert|1000000|atm|GPa atm psi|order=out|lk=on|abbr=on}}. According to convert, 1atm = 101,325 pascals while 1bar = 100,000 pascals. Isatm used correctly in that example? If so, it needs Matm which doesn't sound right (name "mega atmosphere"?). Another detail is that convert has unitsdbar andmbar (millibar and decibar) so the unit code should beMbar (lowercaseb). That agrees with a couple of the references which mentionMbar.Johnuniq (talk)08:31, 22 October 2025 (UTC)[reply]TheSI brochure, despite previously mentioning the bar,[1] now omits any mention of it.[2] The bar has been legally recognised in countries of theEuropean Union since 2004.[3] The USNational Institute of Standards and Technology (NIST)deprecates its use except for "limited use inmeteorology" and lists it as one of several units that "must not be introduced in fields where they are not presently used".[4] TheInternational Astronomical Union (IAU) also lists it under "Non-SI units and symbols whose continued use is deprecated".[5]
References
When converting from cubic inches to cubic centimetres (or vice-versa), why is the 3 superscripted for cm3 but cubic inches is a simple "cu in" abbreviation? Shouldn't it be consistently in3 instead? —TadgStirkland401(TadgTalk-Email)05:25, 15 November 2025 (UTC)[reply]
{{cvt|123|cuin}} → 123 cu in (2,020 cm3){{cvt|123|cm3}} → 123 cm3 (7.5 cu in){{cvt|123|in3}} → 123 in3 (2,020 cm3){{cvt|123|cm3|in3}} → 123 cm3 (7.5 in3){{cvt|123|ft3}}, I'm not seeing the desired result. Instead, I see → 123 cu ft (3.5 m3). When you made the comment "A cubic inch is traditionally abbreviated to cu in", I didn't challenge that. But, if you take a look at the second page ofthis technical document, it is very common in similar documents to see the ft3 annotation style. I'm not sure if it is an American/British thing, or sceintific/engineering thing, or what... But in my many years of electrical/electronic engineering, it is the most common I've ever seen. You've been very helpful and patient. Is there some trick I am missing to get the desired affect? —TadgStirkland401(TadgTalk-Email)03:28, 18 November 2025 (UTC)[reply]
ft3 =cuft,yd3 =cuyd,mi3 =cumi. That means the3 version will produce exactly the same result as thecubic version. Convert has been around a long time and these units are more than 13 years old. One or all of them could be changed but someone would need to first try to find a couple of cases where they are used in articles and see what result should occur in those articles. For example,Columbia River has dozens of converts such as{{cvt|550,000|cuft/s|m3/s|abbr=on}} but also three like{{cvt|12,100|ft3/s|m3/s|abbr=on}} (the|abbr=on is pointless and should be removed, see{{cvt}}). It would look odd if the article suddenly started showing ft3 for three results. However, Wikipedia thrives on change and a discussion here and maybe somewhere else would agree that ft3 and possibly the others should be changed. Is there a particular article where the current behavior is undesirable?Johnuniq (talk)05:22, 18 November 2025 (UTC)[reply]ft3, when abbreviated, would display ft3 instead of cu ft. What about aboutyd3 andmi3?Johnuniq (talk)07:09, 18 November 2025 (UTC)[reply]Guinness323 points out that lengths between 1 cm and 1 m are typically given in cm, but the conversion from inches defaults to mm. This has come up in articles about board games (such as1812: The Campaign of Napoleon in Russia, where they added the "cm" parameter), though I have also added the "cm" parameter while doing conversions for paintings, plants, magnetic tape, and possibly other topics. I might prefer millimeters when fractions of an inch are given and the conversion actually does need tenth-of-centimeter precision, but when distances are going to be rounded to the nearest centimeter anyway, centimeters are more natural, take up less space, and more clearly show the number of significant digits. Would it be possible to make cm the default for lengths 1 cm to 1 m which are rounded to the nearest cm? --Beland (talk)03:46, 20 November 2025 (UTC)[reply]
cm defaults toin butin defaults tomm. It would be easy to makein default tocm if the inch input value is between certain limits, or tomm otherwise. The limits might be between 0.393 and 39.4 inches (1 cm = 0.3937 in and 1 m = 39.37 in). However, there is no way to do that if the value rounds to an integer number of cm. Also, there is no way to have more than two defaults. The change might be desirable for particular articles but it's hard to say whether it would be helpful more widely. I think a few thousand articles have conversions from inches to the default so working out what would be best would be tricky.Johnuniq (talk)05:12, 20 November 2025 (UTC)[reply]lengths between 1 cm and 1 m are typically given in cm. In UK engineering, at any rate, the "recommended multiples and submultiples are the kilometre (m), the millimetre (mm) and the micrometre (μm). The centimetre (cm) and decimetre (dm) should be used only when the recommended prefixes are inconvenient."(Kempe's Engineers Year-Book, 1991, pA1/3).NebY (talk)10:30, 20 November 2025 (UTC)[reply]