Help:Magic words

Magic words (including parser functions, variables and behavior switches) are features of wiki markup that give instructions to Wikipedia's underlying MediaWiki software. For example, magic words can suppress or position the table of contents, disable indexing by external search engines, and produce output dynamically based on the current page or on user-defined conditional logic. Some of these features are especially useful for templates.

This page is a quick reference for magic words. For more information, refer to the main MediaWiki documentation:

General information

In general, there are three types of magic words

  1. Behavior switches: often appear in double underscores, all uppercase, e.g., __NOTOC__. They will change the behavior of a page, rather than return a value.
  2. Parser functions: all in lowercase. A parser function will be followed by colon and pipe-separated parameters, e.g., , wrapped in double braces. They will take a value and return a value.
  3. Variables: these are all uppercase, e.g., . A variable will be wrapped in double braces and will return a value in its place.

The software generally interprets magic words in the following way.

  • Magic words are case sensitive.
  • White space is generously allowed for readability. It will be stripped from the start and end of their keywords and parameters (as is also done inside templates).
  • They can be transcluded, even variables "about the current page". This is ensured by the parsing order.
  • Instead of magically transforming into HTML instructions, <nowiki> tags remove this magic so a magic word can itself be displayed (documented), e.g. <nowiki>.

Magic words compared to templates:

  • As with templates, magic words can be transcluded and substituted.
  • The names of magic words are purposely chosen to be unlike the names of templates, and vice versa. Many parser function names will begin with a # (pound), but template names will not start with a #, and probably not end in a : (colon), or be all-uppercase.
  • The first parameter's syntax differs. In .
Other Languages
Alemannisch: Hilfe:Variable
français: Aide:Mot magique
ગુજરાતી: મદદ:Magic words
Bahasa Indonesia: Bantuan:Kata ajaib
ಕನ್ನಡ: ಸಹಾಯ:Magic words
Bahasa Melayu: Bantuan:Kata sakti
norsk nynorsk: Hjelp:Trylleord
Simple English: Help:Magic words
српски / srpski: Помоћ:Променљиве