The <sub> element marks inline text that should appear as a subscript for typographical reasons. Browsers typically lower the baseline and use slightly smaller text.
Good fits: chemical formulas (H2O), math indices (<var>, and footnote markers. For raised text use <sup>. For decoration-only lowering use CSS vertical-align, not <sub>.
Baseline · Widely available.
Not deprecated and not experimental. Stable across modern browsers since about July 2015.
Typography, not decoration.
Use <sub> when convention calls for a subscript. Do not use it only to shrink or drop letters in a logo or heading.
Syntax
HTML Syntax
syntax.html
<sub>subscript text</sub>
Both start and end tags are required. Content is phrasing content (text and inline elements).
Reference
Attributes
<sub> has no element-specific attributes. Use globals when needed:
Pick by convention, not by whichever looks smaller.
Edge Cases & Pitfalls
Most mistakes use sub as a style knob instead of a typographical mark.
decoration
Not for logos or layout tricks
If you only want lowered letters for looks, use CSS vertical-align (or similar). Save <sub> for real subscripts.
vs sup
Do not swap with sup
Exponents and ordinals usually need <sup>. Atom counts and indices usually need <sub>.
math
Complex math may need MathML
Simple indices work with sub. Large formulas are clearer with MathML than many nested HTML tags.
a11y
Implicit role is subscript
Assistive tech can expose subscript. Keep the content short so the spoken formula stays clear.
nesting
Avoid deep nesting
Do not stack many sub / sup levels for layout. Prefer a formula language when structure gets heavy.
Compatibility
Browser Support
The <sub> element is core HTML in every browser. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
<sub>
Widely available since about July 2015 (and long before as subscript). Chrome, Firefox, Safari, Edge, and Opera all support it fully.
98%Global support (approx.)
Google ChromeAll
Full support
Mozilla FirefoxAll
Full support
Apple SafariAll
Full support
Microsoft EdgeAll
Full support
OperaAll
Full support
Samsung InternetAll
Full support
Internet ExplorerAll
Supported
<sub>Widely supported
Bottom line: Safe to use everywhere for typographical subscripts. Choose sub or CSS by meaning — not only by the lowered look.
Remember
Key Takeaways
Role:<sub> marks typographical subscripts.
Use for: formulas, math indices, and footnote markers.
Compare:sup raises text; CSS lowers for decoration only.
Pairing:<var>x<sub>1</sub></var> is a common math pattern.
One line: use <sub> when typography needs a real subscript — not just smaller text.
UA style
Default CSS Settings
Typical user-agent styling (browsers may add more details):
default.css
sub {
vertical-align: sub;
font-size: smaller;
}
You may restyle sub with CSS, but keep it clearly lowered so formulas stay readable.
Frequently Asked Questions
The sub element marks inline text that should appear as a typographical subscript — for example atom counts in chemical formulas, math indices, or footnote markers.
Visually they can look similar. Use sub when the subscript is part of typographical convention (formulas, indices). Use CSS when you only want a lowered look for decoration or branding.
sub lowers text (subscript). sup raises text (superscript), often used for exponents or ordinals. Pick the one that matches the convention.
No. sub only supports the global attributes, such as class, id, and lang.
No. That is presentation. Style the logo with CSS (for example vertical-align) instead of sub.
Yes. A common math pattern is <var>x<sub>1</sub></var> for a subscripted variable.