Padding with trailing zero?

edit

{{Inflation|index=US|value=0.50|start_year=1908|r=2|fmt=eq}}

produces "equivalent to $17.5 in 2024". How do I convince it to include the trailing zero for the cents, i.e. "equivalent to $17.50 in 2024"? RoySmith (talk) 11:58, 29 October 2025 (UTC)Reply

I'm still seeing this on Ten-Cent Beer Night, which includes r=2, but which displays "$0.4" instead of "$0.40" as the adjusted price. White 720 (talk) 18:40, 6 May 2026 (UTC)Reply
Concur. I think I also noticed it from this very article a few years ago; annoying to see it persists. A similar thing has happened on the iPod Game when I tried to convert a sub-10-dollar item and had it round off to the tens. Unlike, say, in a restaurant where it is obvious, say, $9.9 means $9.90, this doesn't apply to an encyclopedia. I am going to look at getting this fixed sitewide to force a rounding to two digits when this code is used whenever the second digit is truncated. This may take a while, but I am on the case.
Cheers. Electricmaster (talk) 11:27, 31 July 2026 (UTC)Reply
Template talk:Inflation#Template-protected edit request on 1 August 2026: Fix missing trailing zeros
I have lodged a template edit request complete worth a (hopefully) working solution. I'll check back later. Cheers. Electricmaster (talk) 16:16, 31 July 2026 (UTC)Reply

Edit request 18 February 2026

edit

Description of suggested change: The Federal Reserve Bank of Minneapolis CPI table now includes 2025 data (967.5) and has revised its 2024 annual average from 944.9 to 942.7. Please update Template:Inflation/US/dataset to match. This fixes errors on pages such as List of disasters by cost where {{Inflation|US|...|2025|...}} currently fails.


Diff:

| 2024 = 944.9 |#default = 944.9 <!-- *** When changing this, also update the reference in [[Template:Inflation/fn]] and the latest year in [[Template:Inflation/year]]! *** -->
+
| 2024 = 942.7 | 2025 = 967.5|#default = 967.5 <!-- *** When changing this, also update the reference in [[Template:Inflation/fn]] and the latest year in [[Template:Inflation/year]]! *** -->

Brett A. Thomas (talk) 12:08, 18 February 2026 (UTC)Reply

 Completed. P.I. Ellsworth, ed.  welcome!  14:48, 18 February 2026 (UTC)Reply

Edit request 02 March 2026

edit

Description of requested change: A parameter to shorten "equivalent to" would be useful for length-constrained applications. I believe the easiest way to do this would be to add a parameter "fmt=eqs" (for "equivalent short") which can be used in place of "fmt=eq".

Ex: "$500 (equivalent to $1000 in 2025)" --> "$500 (eq. $1000 in 2025)"

DeklinCaban (talk) 16:34, 2 March 2026 (UTC)Reply

That sounds like a good way to confuse readers unnecessarily with an ambiguous abbreviation. See Wikipedia:Manual of Style/Abbreviations for guidance. – Jonesey95 (talk) 01:13, 4 March 2026 (UTC)Reply

Very small values

edit

I've run into a problem On the Australia Post article with the price of letter postage from 1911. Somewhere in the calculation this rounds to zero so we get zero rather than 64 cents. Is there a workaround?


  • 1911: 1d equivalent to A$0 in 2022
  • 1920: 2d equivalent to A$0.79 in 2022

Newystats (talk) 04:48, 6 March 2026 (UTC)Reply

The problem is in the use of the default rounding in the {{£sd}} template:
{{£sd |d=1}} 0.00
{{£sd |d=1.5}} 0.01
{{£sd |d=2}} 0.01
{{£sd |d=3}} 0.01
{{£sd |d=4}} 0.02
{{£sd |d=5}} 0.02
You need to fix the output from that template:
{{Inflation|AU|{{£sd|round=4 |d=1}}|1911|r=2}} 0.64
{{Inflation|AU|{{£sd|round=4 |d=1.5}}|1911|r=2}} 0.96
{{Inflation|AU|{{£sd|round=4 |d=2}}|1911|r=2}} 1.27
{{Inflation|AU|{{£sd|round=4 |d=3}}|1911|r=2}} 1.91
{{Inflation|AU|{{£sd|round=4 |d=4}}|1911|r=2}} 2.55
{{Inflation|AU|{{£sd|round=4 |d=5}}|1911|r=2}} 3.18
I hope that makes sense. – Jonesey95 (talk) 19:00, 7 March 2026 (UTC)Reply
Brilliant! Thanks. Newystats (talk) 22:28, 9 March 2026 (UTC)Reply

Template-protected edit request on 7 March 2026: UK inflation is incorrect (RPI, not CPI)

edit

The documentation at Template:Inflation/UK/dataset says,

This sub-template returns the associated country's CPI for a specific year.

but provides a source for RPI values,

The information in this dataset is input from "The Annual RPI and Average Earnings for Britain, 1209 to 2014 (New Series): UK Retail Price Index"

which overestimate inflation compared to CPI. For example, Template:Inflation says £100 in 2013 is "equivalent to £145 in 2023", compared to a figure of £134.19 for CPI per the Bank of England's inflation calculator. Inspecting the Bank of England's webpage, one finds a definition for window.boeInflationData – essentially a JSON table of the data we want, provided by a reliable source. Let's update Template:Inflation/UK/dataset to use these data instead. AlphaMikeOmega (talk) 15:30, 7 March 2026 (UTC)Reply

I've just used a script to convert the data into wikitext. Please use the following:
The source given at Template:Inflation/doc/cpi-uk would also need updating to https://www.bankofengland.co.uk/monetary-policy/inflation/inflation-calculator.AlphaMikeOmega (talk) 18:07, 7 March 2026 (UTC)Reply
I've published the script in question at User:AlphaMikeOmega/Scripts/generate_inflation_uk_dataset.py. AlphaMikeOmega (talk) 18:39, 7 March 2026 (UTC)Reply
The ONS provides annualised CPI data going back to 1988, including a datum for 2025. It's compatible with the Bank of England's data (using the same 2015/£100 base), but I notice the Bank of England has the wrong value for 2023 (132.2 instead of 130.5, the Bank being incorrect because it cites the ONS). We could correct this and add a 2025 value if we cite both sources. AlphaMikeOmega (talk) 19:03, 7 March 2026 (UTC)Reply
 Done @AlphaMikeOmega: Please supply code that should be added to Template:Inflation/fn as well as updating the /doc page which isn't protected. * Pppery * it has begun... 00:11, 16 March 2026 (UTC)Reply
@Pppery: Thanks! Since the data in use at the moment comes purely from the Bank of England (i.e. lacks ONS data, including the value for 2025 and a correction to the 2023 value), I expect we can use
| UK = {{#tag:ref|UK [[Consumer Price Index]] inflation figures from 1209–2024 based on data from {{cite web |author=<!-- not stated --> |date={{#if:{{{df|}}}|18 February 2026|February 18, 2026}} |title=Inflation calculator |url=https://www.bankofengland.co.uk/monetary-policy/inflation/inflation-calculator |website=[[Bank of England]] |location=London |publisher=[[Bank of England]] |access-date={{#if:{{{df|}}}|7 March 2026|March 7, 2026}} |mode={{{mode|}}} }} |name="inflation-UK" |group={{{group |}}}}}
However, this does not address the fact that the data are not in plaintext but are embedded in the HTML. I am not sure whether referencing [[[User:AlphaMikeOmega/Scripts/generate_inflation_uk_dataset.py]] as well would be proper, nor the correct way to reference the script if it is. I could modify the script to use ONS data as well, in which case both the data and the reference would need updating again, but for now, the above does at least point to the correct webpage for all the data currently in the table. AlphaMikeOmega (talk) 21:55, 17 March 2026 (UTC)Reply
Updated that line in /fn. I don't think you need a ref to the script; the calculator website provides a way for readers to verify the calculation which is sufficient. * Pppery * it has begun... 00:14, 18 March 2026 (UTC)Reply
@AlphaMikeOmega I wrote a replacement script in javascript, so that the data can be easily extracted without using software other than a web browser. I also updated it so that it can process the years that are specified on a month-by-month basis (currently that means 2025). It's on Template:Inflation/doc/cpi-uk. --Ahecht (TALK
PAGE
)
15:28, 1 April 2026 (UTC)Reply

Template-protected edit request on 13 March 2026

edit

AU entry erroneously begins "AU =" in the actual text. Please remove the second "AU =" so it matches the other entries. Mauls (talk) 21:13, 13 March 2026 (UTC)Reply

 Done * Pppery * it has begun... 00:08, 16 March 2026 (UTC)Reply

Using both CPI and GDP in one article?

edit

In Carlisle & Finch, I have some values that should used GDP, and some that should use CPI. How do people typically handle this from a citation point of view? I could put {{Inflation-fn}} after every use of {{Inflation}} to indicate which it is, but that would leave to an absurd clutter of pointless citations. Any better ideas? RoySmith (talk) 23:45, 14 March 2026 (UTC)Reply

MeasuringWorth inflation calculator

edit

Hello. The MeasuringWorth inflation calculator for GBP seems to have updated to now display equivalent prices in 2024. However, the text the template produces in footnotes still reads "equates to approximately £X in 2023". I've been advised that this is something that needs to be changed in the template itself, as opposed to something which can be fixed through source editing. Help much appreciated! Mac Edmunds (talk) 13:23, 25 March 2026 (UTC)Reply

@Mac Edmunds Fixed --Ahecht (TALK
PAGE
)
17:26, 1 April 2026 (UTC)Reply
Thanks very much. Out of interest, and to save me starting up this conversation a few years down the line, will the year displayed always now the year which the calculation is based on? i.e., if it updates to 2026 equivalents, will the text then say “equivalent to X in 2026”? Thanks. Mac Edmunds (talk) 17:38, 1 April 2026 (UTC)Reply
@Mac Edmunds Yes, as long as the article uses the |fmt=eq option rather than manually generating the "in 2026" text AND {{Inflation/year}} is kept up to date with the data set. --Ahecht (TALK
PAGE
)
15:58, 2 April 2026 (UTC)Reply

Edit request 1 April 2026.

edit

Description of suggested change:

Greetings and felicitations. In the UK version of the template "Bank of England" appears twice, as here. Please removed the first instance. Also, there are numerous hyphen-minuses being used for en dashes in date ranges that should be replaced. E.g., "Real Wages and Relative Factor Prices in the Third World 1820-1940: Latin America" —> "Real Wages and Relative Factor Prices in the Third World 1820–1940: Latin America". In fact, the references could use being converted to citation templates (I would prefer CS1), or at least brought into line with MOS:MAJORWORK and MOS:MINORWORK. In your, I have no doubt, exceedingly copious spare time. ;-)

Diff:

Example: "Real Wages and Relative Factor Prices in the Third World 1820-1940: Latin America" ORIGINAL_WIKITEXT
+
Example: "Real Wages and Relative Factor Prices in the Third World 1820–1940: Latin America" CHANGED_WIKITEXT

DocWatson42 (talk) 05:16, 1 April 2026 (UTC)Reply

@DocWatson42:  Done (at least the en dashes and redundant publisher, I'll leave the CS1 template conversion to someone else). --Ahecht (TALK
PAGE
)
14:51, 1 April 2026 (UTC)Reply
Thank you. ^_^ —DocWatson42 (talk)< DocWatson42 (talk) 15:12, 1 April 2026 (UTC)Reply

Inflation template

edit

There has been a change to the template today that has broken the template. It means we now have a large red error message on today's TFA (as of the datestamp on this message). Can someone examine and rectify asap? - SchroCat (talk) 13:45, 1 April 2026 (UTC)Reply

@SchroCat Fixed --Ahecht (TALK
PAGE
)
14:40, 1 April 2026 (UTC)Reply

Notification of template error on Benedict Arnold

edit

Hello,

There seem to be multiple errors in inflation calculation on the page for Benedict Arnold;

Example:

The British promised £20,000 (equivalent to £Error when using Error when using {{Inflation}}: |index= (parameter 1), |value= (parameter 2) and |start_year= (parameter 3) must be specified.: NaN/calculation error, please notify Template talk:Inflation. in 2025)

Thank you for your attention to this matter. Mem0ry-forest (talk) 13:47, 1 April 2026 (UTC)Reply

@Mem0ry-forest Fixed --Ahecht (TALK
PAGE
)
14:40, 1 April 2026 (UTC)Reply

Support for units, like "million"?

edit

Most of my writing is about things that cost a lot of money, to the point where the base unit is not dollars but millions or billions of them. This results in things like "... which was estimated to cost $30 billion." I try to remember to use this template wherever possible, but in cases like these the result is not satisfying, "... (130,024,024,045 in 2025)". Yes, I know I can clean that up using decimals and such, but ideally it would say "... (130 billion in 2025)". Is there a way to do that? If not, may I request it? Maury Markowitz (talk) 12:27, 19 April 2026 (UTC)Reply

While I personally don't write many articles, I have edited an article that seems to do the trick. You can take a look at its formatting.
https://en.wikipedia.org/w/index.php?title=List_of_mergers_and_acquisitions_by_Microsoft&action=edit&editingStatsId=8b0a0b014692f097ac7a&editingStatsOversample=1&gesuggestededit=1&wvprov=sticky-header DNeutral (talk) 22:05, 18 May 2026 (UTC)Reply

Template-protected edit request on 25 May 2026

edit

I need to update NZ from 2024 to 2026. Jonathanischoice (talk) 00:31, 25 May 2026 (UTC)Reply

I need to update the NZ citation, where it currently contains 2018–2024, to read 2018–2026 (or better yet, perhaps something like Since 2018 or 2018– at your discretion (which would not require any further periodic updates until the source changes) Jonathanischoice (talk) 00:36, 25 May 2026 (UTC)Reply

 Completed. The edits have been done to both /fn and to /year. And I've combined the edit requests together for clarity. In reference to your suggestion to vary the format, the source determines this and it seems all the sources go with a 2018–2026 type format. P.I. Ellsworth, ed.  welcome!  01:23, 25 May 2026 (UTC)Reply

Template-protected edit request on 16 June 2026

edit
| FR = 2022
+
| FR = 2025

EvenTwist41 (talk) 00:23, 16 June 2026 (UTC)Reply

Not done for now: Has the data for FR been updated to 2025? Can you provide a source showing this? Zackmann (Talk to me/What I been doing) 01:37, 16 June 2026 (UTC)Reply
I updated it in Special:Diff/1359566136 based on https://www.insee.fr/en/statistiques/serie/010605954 which is the same source that was used until 2022. EvenTwist41 (talk) 02:25, 16 June 2026 (UTC)Reply
 Done @EvenTwist41: perfect! Next time you request an edit like this, if you can include that type of information in the initial request that will expedite things. Just gotta do my double checking before implementing your request. Thanks for providing the diff and source. That was super helpful. --Zackmann (Talk to me/What I been doing) 02:35, 16 June 2026 (UTC)Reply

Make default rounding depending on trailing zeros

edit

To avoid false precision, can we make the default rounding behavior of this template dependent on the number of trailing zeros of the value argument? For instance, {{Inflation|JP|45000|1991}} should output 53000 by default (i.e., |r=-3), not 52746. --bender235 (talk) 19:09, 18 July 2026 (UTC)Reply

Template-protected edit request on 1 August 2026: Fix missing trailing zeros

edit

Hi @Jonesey95, Primefac, MSGJ, and Izno: (and any other available template editors)! I'm pinging a few of you who frequently help with complex template and module requests, hoping someone might have a moment to review this bug fix and verify that it works.

Description of suggested change: Currently, {{#invoke:Math|round|...}} strips trailing zeros even when an explicit number of decimal places is requested via the r parameter (e.g., r=2). Changing this function to {{#invoke:Math|precision_format|...}} correctly rounds the number while preserving necessary trailing zeros, and it functions seamlessly inside the existing {{formatnum:...}} wrappers.

This resolves issues reported in the Padding with trailing zero? section above, where encyclopedia currency amounts look incorrect when trailing zeros are cut off.

Live examples as proof of concept:

  • On Ten-Cent Beer Night, the inflation-adjusted price using r=2 incorrectly displays as $0.4 instead of $0.40.
  • On iPod Game, sub-10-dollar currency items get truncated to a single decimal (e.g. displaying $9.9 instead of $9.90).
  • {{Inflation|index=US|value=0.50|start_year=1908|r=2|fmt=eq}} yields "equivalent to $17.5 in 2024" instead of the desired "$17.50".

Diff:

-->{{formatnum: {{ #iferror: {{#invoke:Math|round|1={{ #expr: {{formatnum:{{{value|{{{2}}}}}}|R}} {{#ifeq:{{{start_year|{{{3}}}}}}|{{CURRENTYEAR}} | * 1 | {{Inflation/{{{index|{{{1}}}}}}|{{{start_year|{{{3}}}}}}|{{{end_year|{{{4|{{Inflation/year|{{{index|{{{1}}}}}}}}}}}}}}}} }} round {{{r|0}}} }}|2={{{r|0}}}}} |<span class="error">Error when using {{tl|Inflation}}:<!-- --> [[NaN]]/calculation error, please notify [[Template talk:Inflation]].</span><!-- -->{{main other|[[Category:Pages with errors in inflation template]]}}<!-- this error indicates template bug, always categorize -->}}<!-- -->|{{#ifeq:{{{fmt|raw}}}|raw|R|}}<!-- -->}}<!--
+
-->{{formatnum: {{ #iferror: {{#invoke:Math|precision_format|1={{ #expr: {{formatnum:{{{value|{{{2}}}}}}|R}} {{#ifeq:{{{start_year|{{{3}}}}}}|{{CURRENTYEAR}} | * 1 | {{Inflation/{{{index|{{{1}}}}}}|{{{start_year|{{{3}}}}}}|{{{end_year|{{{4|{{Inflation/year|{{{index|{{{1}}}}}}}}}}}}}}}} }} round {{{r|0}}} }}|2={{{r|0}}}}} |<span class="error">Error when using {{tl|Inflation}}:<!-- --> [[NaN]]/calculation error, please notify [[Template talk:Inflation]].</span><!-- -->{{main other|[[Category:Pages with errors in inflation template]]}}<!-- this error indicates template bug, always categorize -->}}<!-- -->|{{#ifeq:{{{fmt|raw}}}|raw|R|}}<!-- -->}}<!--

Thanks so much for taking a look and for all the work you do maintaining these core templates!

Electricmaster (talk) 16:11, 31 July 2026 (UTC)Reply

The next step is for you to put the change in the relevant /sandbox and show that it works on the /testcases page without breaking anything. – Jonesey95 (talk) 12:51, 6 August 2026 (UTC)Reply
@Jonesey95: I have updated the /sandbox with the `precision_format` fix and added testcases at the bottom of the /testcases page that demonstrate the fix in action. The trailing zeros are now correctly preserved in the sandbox output (e.g. `$0.40` instead of `$0.4`), and the existing testcases show that nothing else is broken. Let me know if everything looks good to push to the live template! Electricmaster (talk) 09:39, 11 August 2026 (UTC)Reply
I tried the sandbox version in Special:Diff/1368944521. Looks good to me. RoySmith (talk) 00:46, 12 August 2026 (UTC)Reply
 DoneJonesey95 (talk) 10:12, 16 August 2026 (UTC)Reply
Great! Thanks. Now if only I was unblocked from the mainspace! ;) Electricmaster (talk) 11:51, 16 August 2026 (UTC)Reply
I've rolled back the change as it led to other templates such as {{FXConvert}} breaking. Having a display toggle (defaulting to precision_format for display but with a setting to use round inside of other templates) would be an ideal solution here. Chaotic Enby (in solidarity · talk · contribs) 14:16, 16 August 2026 (UTC)Reply
Sigh. But the upside is I never even knew {{FXConvert}} existed. It looks like it's a better alternative to using {{inflation}} directly, so I'm glad to have learned about it! RoySmith (talk) 14:38, 16 August 2026 (UTC)Reply
@Chaotic Enby and Jonesey95: Excellent catch on the {{FXConvert}} breakage! precision_format outputs HTML for large scientific notation and typographic minus signs, which was causing #expr to crash in wrapper templates. I've updated the /sandbox to implement exactly the toggle you suggested. It now uses {{#invoke:Math|{{#ifeq:{{{fmt|raw}}}|raw|round|precision_format}}|1={{, which keeps round for raw numeric output (the default, safe for {{FXConvert}} and #expr), but switches to precision_format whenever a display format like fmt=eq or fmt=c is explicitly called.
Updated diff with the toggle:
-->{{formatnum: {{ #iferror: {{#invoke:Math|round|1={{ #expr: {{formatnum:{{{value|{{{2}}}}}}|R}} {{#ifeq:{{{start_year|{{{3}}}}}}|{{CURRENTYEAR}} | * 1 | {{Inflation/{{{index|{{{1}}}}}}|{{{start_year|{{{3}}}}}}|{{{end_year|{{{4|{{Inflation/year|{{{index|{{{1}}}}}}}}}}}}}}}} }} round {{{r|0}}} }}|2={{{r|0}}}}} |<span class="error">Error when using {{tl|Inflation}}:<!-- --> [[NaN]]/calculation error, please notify [[Template talk:Inflation]].</span><!-- -->{{main other|[[Category:Pages with errors in inflation template]]}}<!-- this error indicates template bug, always categorize -->}}<!-- -->|{{#ifeq:{{{fmt|raw}}}|raw|R|}}<!-- -->}}<!--
+
-->{{formatnum: {{ #iferror: {{#invoke:Math|{{#ifeq:{{{fmt|raw}}}|raw|round|precision_format}}|1={{ #expr: {{formatnum:{{{value|{{{2}}}}}}|R}} {{#ifeq:{{{start_year|{{{3}}}}}}|{{CURRENTYEAR}} | * 1 | {{Inflation/{{{index|{{{1}}}}}}|{{{start_year|{{{3}}}}}}|{{{end_year|{{{4|{{Inflation/year|{{{index|{{{1}}}}}}}}}}}}}}}} }} round {{{r|0}}} }}|2={{{r|0}}}}} |<span class="error">Error when using {{tl|Inflation}}:<!-- --> [[NaN]]/calculation error, please notify [[Template talk:Inflation]].</span><!-- -->{{main other|[[Category:Pages with errors in inflation template]]}}<!-- this error indicates template bug, always categorize -->}}<!-- -->|{{#ifeq:{{{fmt|raw}}}|raw|R|}}<!-- -->}}<!--
The /testcases are passing cleanly again. Would you mind giving it one more look? Electricmaster (talk) 17:22, 16 August 2026 (UTC)Reply
I would've done it the other way around, as the template is used on many articles directly, while templates that call it can be targeted more easily. So if we don't want to add an extra parameter in every single article it is being used on, having the default be the reader-friendly formatting makes more sense. Chaotic Enby (in solidarity · talk · contribs) 17:42, 16 August 2026 (UTC)Reply
I'm not exactly following what broke, and I don't need it explained to me, but what appears to be needed are additional testcases on the /testcases page. Please provide examples of markup that broke with the initial change. That way, if someone tries to make a similar change again, the testcases page will show problems with the /sandbox. Thanks. – Jonesey95 (talk) 22:27, 16 August 2026 (UTC)Reply
Added! Chaotic Enby (in solidarity · talk · contribs) 14:10, 17 August 2026 (UTC)Reply

Scientific notation discrepancy

edit

The template currently outputs very large numbers in the format x10 to the power, rather than as E+ as is expected by other templates. This breaks compatibility with templates like Template:Format price for very large numbers, with even the documentation Template:Inflation#Very large results displaying an error. Wolferpedia18 (talk) 14:10, 16 August 2026 (UTC)Reply

The template has stopped outputting the incorrect format thanks to an edit revert by Chaotic_Enby, so no further action is needed. Thanks! Wolferpedia18 (talk) 17:46, 16 August 2026 (UTC)Reply