**`<var>`** semantically marks a variable name — in math ('let <var>x</var> be the number of apples'), in a programming discussion ('the <var>count</var> variable increments each loop'), or in a placeholder within a command ('run <code>cd <var>folder-name</var></code>'). Browsers render it in italics by default, similar to `<i>`, but with the added semantic meaning that it's specifically a variable/placeholder.
1Understanding <var>
`<var>` semantically marks a variable name — in math ('let <var>x</var> be the number of apples'), in a programming discussion ('the <var>count</var> variable increments each loop'), or in a placeholder within a command ('run <code>cd <var>folder-name</var></code>'). Browsers render it in italics by default, similar to <i>, but with the added semantic meaning that it's specifically a variable/placeholder.
In documentation showing a command template like `mkdir <folder-name>`, wrapping the placeholder part in <var> tells the reader (and assistive tech) that it's meant to be substituted, not typed literally.
<p>In the formula <var>a</var><sup>2</sup> + <var>b</var><sup>2</sup> = <var>c</var><sup>2</sup>, all three are variables.</p>2Practical Example
Here is a real-world application of <var> showing how it is used in production HTML.
<!-- Placeholder in a command template -->
<p>Run <code>git clone <var>repository-url</var></code>, replacing the placeholder with your repo's URL.</p>3Best Practices
Follow these guidelines when working with <var>:
1. Use <var> for variable names in math and code discussions
2. Use <var> for placeholder text in command templates the reader should substitute
3. Combine with <code> when the variable appears inside a code snippet
Tip: In documentation showing a command template like `mkdir <folder-name>`, wrapping the placeholder part in <var> tells the reader (and assistive tech) that it's meant to be substituted, not typed literally.
<p>In the formula <var>a</var><sup>2</sup> + <var>b</var><sup>2</sup> = <var>c</var><sup>2</sup>, all three are variables.</p>