This template is to help facilitate the displaying of variable names (in mathematics, computer source code, etc.) with thesemantically correct <var>...</var>, which also renders the variable in italics, as is customary. This method is preferred to simply italicizing, for accessibility, content/presentation separation, semantic Web, and metadata reasons; [X]HTML's <var> element has semantic meaning, while simple italicization does not.

Example:

{{var|username}}

outputs

<var>username</var>

which renders as:

username

compare to simple ''username'' italicization:

username

When used as variables, the letters "I" (upper-case "i") and "l" (lower-case "L") should be rendered with {{varserif}} instad of {{var}}, to make them more distinguishable.

  • {{varserif}} – same as {{var}} but uses serif font, especially for distinguishing between I (upper-case i) and l (lower-case L) as variables
  • {{wikivar}} – for displaying wikicode variables and magicwords as they would appear in source code, e.g.{{PAGENAME}}, {{DEFAULTSORT:Jones, Jennifer}}
  • {{code}} – for computer source code ({{var}} and other templates cannot b used inside it; in that case use<code></code> as the wrapper, not {{code}})
  • {{kbd}} - for indicating user input
  • {{samp}} - for example output
  • {{key press}} - for indicating the input of specific keystrokes, e.g. CtrlX
  • {{em}} – similar template for semantically indicating mild emphasis instead of simple typographical italicization