Syntax
H<sub>2</sub>O and E = mc<sup>2</sup>Examples
Chemical Formula
Using subscript for a chemical formula.
<p>Water is H<sub>2</sub>O, and carbon dioxide is CO<sub>2</sub>.</p>Mathematical Exponent
Using superscript for an exponent.
<p>Einstein's famous equation is E = mc<sup>2</sup>.</p>Footnote Reference
Using superscript to mark a footnote reference.
<p>This claim needs verification<sup><a href="#footnote1">[1]</a></sup>.</p>Best practices
- Use sub/sup only for their real typographic meaning, not simply to make text smaller
- For ordinal suffixes like "1st" or "2nd", consider whether superscript styling is actually desired by your target audience — many style guides avoid it
- Keep subscript/superscript text short — long passages become hard to read at reduced size
- For footnote systems, pair sup with proper anchor links back and forth between reference and note
Browser compatibility
Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.
<sub>
Desktop
- Chrome
- Supported
From 1 - Firefox
- Supported
From 1 - Safari
- Supported
By 4 (possibly earlier) - Edge
- Supported
From 12 - Opera
- Supported
From 15
Mobile
- Safari on iOS
- Supported
By 3.2 (possibly earlier) - Chrome for Android
- Supported
From 18 - Firefox for Android
- Supported
From 4 - Samsung Internet
- Supported
From 1.0
MDN BCD record for this feature · MDN reference
Support history and limitations
Chrome
- From 1
Firefox
- From 1
Safari
- By 4 (possibly earlier)
Edge
- From 12
Opera
- From 15
Safari on iOS
- By 3.2 (possibly earlier)
Chrome for Android
- From 18
Firefox for Android
- From 4
Samsung Internet
- From 1.0
<sup>
Desktop
- Chrome
- Supported
From 1 - Firefox
- Supported
From 1 - Safari
- Supported
By 4 (possibly earlier) - Edge
- Supported
From 12 - Opera
- Supported
From 15
Mobile
- Safari on iOS
- Supported
By 3.2 (possibly earlier) - Chrome for Android
- Supported
From 18 - Firefox for Android
- Supported
From 4 - Samsung Internet
- Supported
From 1.0
MDN BCD record for this feature · MDN reference
Support history and limitations
Chrome
- From 1
Firefox
- From 1
Safari
- By 4 (possibly earlier)
Edge
- From 12
Opera
- From 15
Safari on iOS
- By 3.2 (possibly earlier)
Chrome for Android
- From 18
Firefox for Android
- From 4
Samsung Internet
- From 1.0
MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.