Subscript renders text below the normal baseline, typically used for chemical formulae, mathematical notation, and footnote-style numbering. In flavours that support it natively, it is written with ~ on each side. Where native support is unavailable, the HTML <sub> element is the standard fallback.
The chemical formula for water is H~2~O.
Carbon dioxide is CO~2~.
HTML fallback (any renderer that passes through inline HTML):
The chemical formula for water is H<sub>2</sub>O.
The chemical formula for water is H~2~O.
Carbon dioxide is CO~2~.
HTML fallback (any renderer that passes through inline HTML):
The chemical formula for water is H2O.
Best Practice
- Use the native
~text~syntax only when you are confident your renderer supports it — it produces no subscript in GitHub Flavored Markdown or CommonMark and may conflict with strikethrough in some parsers. - Use
<sub>text</sub>as the portable fallback when you need subscript in mixed-renderer environments such as GitHub or a Grav site. - Keep subscript text short — a single character or short number. Longer subscript runs are hard to read.
Notes
Conflict with Strikethrough
In GFM, ~~text~~ is strikethrough. A single ~text~ in GitHub Flavored Markdown produces no output — it is not subscript. In Pandoc, ~text~ is subscript, and strikethrough requires the strikeout extension with ~~. Be aware of this distinction when writing for multiple target renderers.
Spacing
The native ~ syntax does not allow spaces inside the subscript span in most flavours. H~2 O~ will not render as subscript — use H~2~O or the HTML form instead.
Markdown Flavour Support
Not in CommonMark or GitHub Flavored Markdown; native syntax supported by Pandoc and MultiMarkdown. HTML fallback broadly available.
Flavour Support Detail
| Flavour | Support | Notes |
|---|---|---|
| Original Markdown | No | Not defined in the original spec. |
| CommonMark | No | Not part of the CommonMark spec; <sub> HTML fallback works. |
| GitHub Flavored Markdown | No | ~text~ not subscript in GFM; <sub> HTML fallback works in files. |
| Pandoc Markdown | Yes | ~text~ native subscript via the subscript extension. |
Practical Examples
- Chemical formula in a science hobby post: Write the molecular formula correctly so readers immediately recognise the compound without having to interpret awkward inline text.
Baking soda is sodium bicarbonate — NaHCO<sub>3</sub> — and reacts with acid to produce CO<sub>2</sub>, which causes the rise.
Baking soda is sodium bicarbonate — NaHCO3 — and reacts with acid to produce CO2, which causes the rise.
- Isotope notation in an astronomy or geology journal: Identify an isotope using the conventional subscript/superscript notation (combined with superscript for the mass number).
Carbon dating relies on the decay of C<sub>6</sub> (carbon-14) back into nitrogen.
Carbon dating relies on the decay of C6 (carbon-14) back into nitrogen.
- Numbered reference in a recipe without footnote support: Use a subscript number inline as a lightweight reference marker when your platform does not support footnotes.
Add the starter<sub>1</sub> to the dough and mix until fully incorporated.
<sub>1</sub> Your starter should be active and bubbly — fed 4–6 hours before use.
Add the starter1 to the dough and mix until fully incorporated.
1 Your starter should be active and bubbly — fed 4–6 hours before use.