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).


  • As with templates, magic words can be transcluded and substituted.
  • The names of , and vice versa. Many parser function names will begin with the # sign, but template names will not start with a # sign, and probably not end in a : colon character, or be all-uppercase.
  • The first parameter's syntax differs. In , the name is #magic and it will be followed by an unspaced : colon and a required input parameter, p1. The first |p1= of a template is optional but would be preceded by a | pipe instead of a : colon.
Other Languages
Alemannisch: Hilfe:Variable
français: Aide:Mot magique
ગુજરાતી: મદદ:Magic words
Bahasa Indonesia: Bantuan:Kata ajaib
italiano: Aiuto:Direttive
Bahasa Melayu: Bantuan:Kata sakti
norsk nynorsk: Hjelp:Trylleord
српски / srpski: Помоћ:Променљиве