The HTML <var> element represents a variable in a mathematical expression or a programming context.
| Content categories | Flow content, phrasing content, palpable content. |
|---|---|
| Permitted content | Phrasing content |
| Tag omission | Both start and end tags are required |
| Permitted parents | Any element that accepts phrasing content. |
| Permitted ARIA roles | Any |
| DOM Interface | HTMLElement |
Attributes
This element only includes the global attributes.
Typical default style properties
var {
font-style: italic;
}
Example
<p> A simple equation: <var>x</var> = <var>y</var> + 2 </p>
A simple equation: x = y + 2
Specifications
| Specification | Status | Comment |
|---|---|---|
| HTML Living Standard The definition of '<var>' in that specification. |
Living Standard | |
| HTML5 The definition of '<code>' in that specification. |
Recommendation |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
No compatibility data found. Please contribute data for "html.elements.var" to the MDN compatibility data repository.

