CSS Portal

HTML <sub> Tag

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The <sub> tag in HTML is used to define subscript text, which appears slightly below the baseline of the surrounding text. Subscripts are commonly used in mathematical expressions, chemical formulas, and scientific notation to indicate things like chemical elements (H₂O), mathematical indices (x₁, x₂), or other specialized notation where characters need to appear lower than the normal text line.

Visually, the <sub> tag decreases the vertical position of the text and usually reduces its font size slightly compared to the surrounding content, though exact rendering can depend on the browser and applied CSS. The tag does not carry semantic meaning beyond marking text as subscript; it is purely presentational.

Example usage:

<p>The chemical formula for water is H<sub>2</sub>O.</p>
<p>In mathematics, the first term of a sequence is denoted as a<sub>1</sub>.</p>

In these examples, the numbers "2" and "1" are rendered lower than the main text, making them subscript. The <sub> tag can be used inline with other text and can be nested inside other elements such as <span> or <p>.

Key points:

  • Inline element
  • Displays text below the baseline
  • Typically used in scientific, mathematical, or technical contexts
  • Reduces font size slightly by default (but can be overridden with CSS)

Properties

Permitted Parents
Any element that accepts phrasing content
Content
Inline and text
Start/End Tags
Start tag: required, End tag: required

Example

The chemical formula for water is h<sub>2</sub>0

Attributes

None

Global Attributes

The <sub> tag also supports the Global Attributes in HTML5

Event Attributes

The <sub> tag also supports the Event Attributes in HTML5

Browser Support

The following information will show you the current browser support for the HTML <sub> tag. Hover over a browser icon to see the version that first introduced support for this HTML tag.

This tag is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 26th December 2025

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!