[edit] [purge] Template documentation

The following documentation is transcluded from Template:Inflation/doc.

Information icon.svg This template employs intricate features of template syntax.
You are encouraged to familiarise yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly, as this template may appear on a large number of pages.
Remember that you can conduct experiments, and should test all improvements, in either the general Template sandbox or your user space before changing anything here.

This template takes a country_code, for example, "US" for the United States or "UK" for United Kingdom, a value in that country's currency, a start_year, and applies to it the country's consumer price inflation until "recently" or another end year.[1] For example, this template calls the U.S. inflation table located in the sub-template Template:Inflation/US/dataset to perform the U.S. calculation. This means that whenever a new year arrives and the inflation tables are updated, all articles using this template have their displayed values updated accordingly.

Alternatively, you can provide a second, optional end_year parameter, and the value will be inflated for the period between the two years, providing a convenient way of getting values from different time periods adjusted around the same date.



The supported countries are listed below, with their country_code and minimum start_year:

Country name country_code minimum for start_year
Australia[2] AU 1901
Canada[3] CA 1916
Germany[4] DE 1882
United Kingdom[5] UK 1264
United States[6] US 1800


  • country_code (parameter 1) can be: AU, CA, DE, UK, US, UKNGDPPC, etc.
  • value (parameter 2) can have commas, but no currency sign.
  • start_year (parameter 3) depends on years allowed for each country.
  • end_year (parameter 4), if provided, must be higher (later) than start_year, but not higher than the current year, and will default to "recently" if left out;
  • r=digit sets the digit in which the value must be rounded, defaulting to "0" if unspecified, i.e., without cents (see Tips & Tricks below for details on how to use this parameter).
  • fmt=c will insert commas into the inflated value.
  • fmt=eq will show an equivalent-to phrase.
  • cursign=X will set the currency sign (default: $).


  • Green tickY {{inflation|DE|1000000|2000}} = {Inflation} - NaN check amount: 1000000 or year: 2000. 
  • Green tickY {{inflation|US|1000000|2001|2001}} = 1000000
  • Green tickY {{inflation|US|1000000|1990|2005|...}} = 1494905.76
  • Green tickY {{inflation|UK|1000000|1323|1978|...}} = 68533000

Entering invalid parameters will result in a link to the NaN article:

  • Red XN {{inflation}} = 22565
  • Red XN {{inflation|abc}} = Expression error: Unrecognized punctuation character "[".{Inflation} - NaN check amount: {{{2}}} or year: {{{3}}}. 
  • Red XN {{inflation|DE|1000000}} = {Inflation} - NaN check amount: 1000000 or year: {{{3}}}. 
  • Red XN {{inflation|US|1000000|1200|3000}} =
    {Inflation} - Year: 1200 lower than US minimum, 1800, for amount: 1000000. 
    {Inflation} - End year: 3000 greater than current year, 2022 for amount: 1000000. NaN
  • Red XN {{inflation|UK|1000000|2005|2004}} =
    {Inflation} - Start year: 2005 greater than end year, 2004 for amount: 1000000. NaN

Tips & Tricks

Currency conversion

This template is currency agnostic, which means it doesn't convert between different currencies. Thus, if you wanted to know how much DM 1,000.00 marks in 1960 are worth nowadays, entering {{inflation|DE|1000|1960|r=2}} would provide a result ({Inflation} - NaN check amount: 1000 or year: 1960. ) still in marks, not in euros.

Consequently, if you need a result in another currency than the one in which the original value is stated, for now you must do the conversion manually, as in the following example which uses the defined conversion rate of € 1 = DM 1.95583:

  • Green tickY {{#expr:({{inflation|DE|1000|1960|r=2}} / 1.95583) round 2}} = Expression error: Unrecognized punctuation character "{".

A currency conversion template to ease these conversion tasks is planned. This section will be updated accordingly once it's developed.


By default the values are calculated to the unit, as for most huge values cents are undesirable. If you need a different precision you can provide the |r= parameter to determine in which digit the rounding must happen. To obtain cents you'd use |r=2, but other values can be used, including negative ones: |r=-3, for example, will round to the nearest thousand, |r=-6 to the nearest million, and so on and so forth.


For a better visualization you can format the returned value using either the internal {{formatnum:}} magic word, or the alternative {{formatprice}} template (see below). Each method has its advantages and disadvantages.

{{formatnum:}} is the standard method for formatting numbers in MediaWiki. It adds thousands and decimal separators according to the user settings, and works well for raw numbers composed of up to 15 digits and a dot. On the other hand, it doesn't allow one to set how many digits must be shown after the decimal dot. Thus, a calculated value of "1234.5" will appear as "1,234.5", not the expected "1,234.50", making it better suited for integer prices unless the value is known and you can add the missing zeros by hand:

  • Green tickY DM {{formatnum:{{inflation|DE|1000000|1957|1978}}}}.00 = DM {Inflation} - NaN check amount: 1,000,000 or year: 1,957. .00
  • Green tickY £{{formatnum:{{inflation|UK|1000000|1323|1978|...}}}} = £68,530,000
  • Green tickY ${{formatnum:{{inflation|US|1000000|1990|r=2}}}} = $1,778,909.83

Another potential source of difficulties resides in the way certain calculated values are expressed. In many cases the result comes as a number in engineering units ("1.2E+9" instead of "1200000000"), and when that happens {{formatnum:}}'ing the result fails. A workaround then is to express the value to be inflated with fewer digits, adding a multiplier text such as "million" after the result, and then hitting the "Show preview" button as many times as needed, changing parameters until the best result is found:

  • Red XN ${{formatnum:{{inflation|US|1000000000|1900|r=-8}}}} = $27,900,000,000
  • Red XN ${{formatnum:{{inflation|US|1000000|1900|r=-5}}}} thousand = $27,900,000 thousand
  • Green tickY ${{formatnum:{{inflation|US|1000|1900|r=-2}}}} million = $27,900 million
  • Green tickY ${{formatnum:{{inflation|US|1|1900|r=1}}}} billion = $27.9 billion

The following section provides an automated way of avoiding this trial and error scenario.


{{formatprice}} is a template specifically designed to display price values, both big and small, in a more pleasant way than {{formatnum:}} allows for. For example, instead of showing the whole of a huge number such as "953,783,409,856.12", it would show it as "954 billion", while small numbers have their cents part appearing as expected, "1234.5" being properly shown as "1.23 thousand".

On the down side, {{formatprice}} has no built-in intelligent handling of user locale settings, which means that some users might see a dot or a comma the opposite way they'd expect. As a general rule of thumb this shouldn't be a serious concern though, as most numbers in Wikipedia are hand-written anyway and will show as entered regardless of user settings.

  • Green tickY DM {{Formatprice|{{inflation|DE|1000000|1957|1978}}}} = DM NaN
  • Green tickY £{{Formatprice|{{inflation|UK|1000000|1323|1978|...}}}} = £68.5 million
  • Green tickY ${{Formatprice|{{inflation|US|1000000|1990|r=2}}}} = $1.78 million
  • Green tickY ${{Formatprice|{{inflation|US|1000000000|1900|r=-8}}}} = $27.9 billion

It's a good practice to provide a valid reference for the prices calculated with this template in the articles where it's used. The template {{Inflation-fn}} was developed to ease this task. It accepts as its single parameter the same country codes used here, and will generate one or more appropriate footnotes. Typically, this is how a piece of text using it looks like:

  • In 1910 a ''blah'' cost on average £1,000. This is equivalent to £{{Formatprice|{{Inflation|UK|1000|1910|r=2}}}} in present day terms.{{Inflation-fn|UK}}

Resulting in this converted code (notice the footnote link at the end):

  • In 1910 a blah cost on average £1,000. This is equivalent to £75.7 thousand in present day terms.[5]

The footnote thus generated appears whenever {{reflist}} or <references /> is used in an article, usually in its "References" section. See below for the live example in this document's own References section, or click the above generated footnote to jump to it.


  1. Currently it isn't possible to "de-inflate" a value to what it would have been in a previous year. If you need this functionality, please request it at the talk page. Adding it won't be difficult, but there's no point in doing so before someone actually needs it.
  2. Substitution isn't supported at all. Trying to {{subst:Inflation|...}} would only result in a long sequence of embedded parser code without any direct benefit. If you need to obtain an inflated price only once, please use the special ExpandTemplates page then copy the result and paste it at the desired location.

Developer Documentation

An inflation series represents templates in the following categories:

  • Template:Inflation/name
  • Template:Inflation/name/dataset
  • Template:Inflation/name/startyear
  • Template:Inflation/doc/name (Which is then displayed at Inflation/name/dataset as the documentation, and needs to refer to the original data source)

Modifications need to be made to:

  • Template:Inflation-fn

See also

  • {{Inflation-fn}}
  • {{Formatprice}}
  • Inflation
  • Consumer price index
  • Harmonised Index of Consumer Prices
  • List of country codes
  • List of circulating currencies
  • United States Consumer Price Index
  • Consumer Price Index (United Kingdom)


  1. ^ How recently depends on how the data set for each country is constructed, and on the internal tables being updated accordingly every January. Some data tables provide inflation data up to December 31, 2021, others up to roughly June-July 2021, and others yet up to December 31, 2020.
  2. ^ Australian Consumer Price Inflation figures follow the Long Term Linked Series provided in Australian Bureau of Statistics (2009) 6461.0 - Consumer Price Index: Concepts, Sources and Methods, 2009 as explained at §§3.10–3.11; this series comprises "from 1901 to 1914, the A Series Retail Price Index; from 1914 to 1946-47, the C Series Retail Price Index; from 1946-47 to 1948-49, a combination of the C Series Index, excluding rent, and the housing group of the CPI; and from 1948-49 onwards, the CPI." (3.10)
  3. ^ Canadian inflation numbers based on Statistics Canada. "Consumer Price Index, historical summary". CANSIM, table (for fee) 326-0021 and Catalogue nos. 62-001-X, 62-010-X and 62-557-X. Last modified: 2011-01-25. Retrieved January 16, 2012
  4. ^ German inflation numbers based on data available from Deutsches Statistisches Bundesamt.
  5. ^ a b UK CPI inflation numbers based on data available from Lawrence H. Officer (2010) "What Were the UK Earnings and Prices Then?" MeasuringWorth.
  6. ^ Staff. Consumer Price Index (estimate) 1800–2012. Federal Reserve Bank of Minneapolis. Retrieved February 22, 2012.
This page uses content from the English language Wikipedia. The original content was at Template:Inflation. The list of authors can be seen in the page history. As with this Familypedia wiki, the content of Wikipedia is available under the Creative Commons License.