<sub>

<sub> marks text whose subscript position follows a typographic convention, such as chemical formulas or indexed variables. It typically uses smaller text below the baseline.

A chemical formula

The subscript belongs to the notation: water contains two hydrogen atoms per molecule.

Inspect sub markupLink

HTML and CSS

HTML

<p>Water’s chemical formula is H<sub>2</sub>O.</p>
<p>An indexed value can be written as <var>x</var><sub>1</sub>.</p>

CSS

sub {
  font-size: 0.75em;
}

Edit HTML or CSS to update the preview as you type. Copy code snippet copies the selected tab. Preview spacing and font defaults are not included.

Content and reading

Sub accepts phrasing content and global attributes. The notation is not guaranteed to be read as a complete mathematical or chemical expression by every assistive technology. Supply surrounding explanation for unfamiliar notation, and consider MathML for complex mathematics.

Do not use sub to move a logo’s letters down purely for design. Use CSS vertical-align or positioning for that appearance.

Common mistake

A footnote marker does not need a sub nested inside a sup. Use a straightforward sup containing a link, and provide the note’s target. Try removing the font-size rule here: browser defaults still generally display conventional subscripts.

Sources and browser support

MDN: sub describes the syntax and links to the specification and compatibility data. Check individual values in that table when supporting older browsers.