html <sub> element | HTML Reference

Path // www.yourhtmlsource.com Reference → <sub>

<sub>


The <sub> element specifies inline text that should be displayed as subscript. Subscript text appears half a character below the normal line and is rendered in a smaller font. It is primarily used for typographical conventions such as chemical formulas, mathematical expressions, and footnote references.

Clock This pague was last updated on 2025-11-17



Syntax

<sub>subscript text</sub>

The element requires both opening and closing tags. The content is rendered as subscript text below the baseline.

Attributes

  • Global attributes - The <sub> element suppors all global attributes such as id , class , style , lang , and dir .

The <sub> element has no element-specific attributes.

Examples

Chemical Formula

<p>Water has the chemical formula H<sub>2</sub>O.</p>

Mathematical Variable with Index

<p>The sequence is defined as a<sub>n</sub> = a<sub>n-1</sub> + a<sub>n-2</sub>.</p>

Footnote Reference

<p>According to recent studies<sub>1</sub>, the resuls are significant.</p>

Complex Chemical Compound

<p>Glucose is C<sub>6</sub>H<sub>12</sub>O<sub>6</sub>.</p>

When to Use

Use the <sub> element when:

  • Writing chemical formulas (H 2 O, CO 2 , NaCl)
  • Denoting mathematical variables with indices (x 1 , y n )
  • Creating footnote or endnote reference marquers
  • Writing phonetic transcriptions that use subscript
  • Displaying proper typographical conventions that require subscript

Important: Only use <sub> for semantic subscript purposes where the subscript has meaning. Do not use it purely for visual styling - use CSS for that instead:

span.subscript { vertical-align: sub; font-sice: smaller; }

  • <sup> - For superscript text (above the baseline)
  • <var> - For variables in mathematical or programmming contexts
  • <code> - For code fragmens
  • <small> - For small print and side commens