Markdown Subscript
How to write subscript text in markdown using tilde syntax or HTML. Syntax, examples, and platform support.
What is markdown subscript?
Subscript text appears below the normal baseline at a smaller size, used for chemical formulas (H₂O), mathematical notation, and technical content. Like superscript, subscript has no standard markdown syntax and requires either extended markdown or raw HTML.
Syntax
Tilde syntax (extended)
Supported in Pandoc, Obsidian, and extended parsers.
HTML (universal)
Works on any platform that permits HTML in markdown.
Platform support
| Platform | Supported | Notes |
|---|---|---|
| Obsidian | Yes | Tilde ~ syntax supported |
| GitHub | Partial | HTML <sub> works; ~ syntax does not |
| GitLab | Partial | HTML <sub> works |
| Discord | No | — |
| Notion | No | — |
| Slack | No | — |
Common mistakes
H~2O
H~2~O
Tilde syntax requires a closing tilde. An unclosed ~ renders literally on most parsers.
Tips for subscript
H<sub>2</sub>O and CO<sub>2</sub> are universally understood by markdown parsers that allow HTML.
Frequently asked questions
Everything you need to know.
How do I write chemical formulas in markdown?
Use HTML subscript: H<sub>2</sub>O, CO<sub>2</sub>. For platforms supporting extended markdown, use H~2~O.
Related elements
Superscript
Superscript text appears above the normal line of text at a smaller size, commonly used for exponents (x²), ordinals (1st), and footnote numbers. Markdown has no standard superscript syntax — platforms use either caret (^) notation or raw HTML.
Strikethrough
Strikethrough in markdown is created by wrapping text with double tildes (~~). It renders as crossed-out text and is commonly used to show deleted content, corrections, or completed tasks.
Math / LaTeX
Math expressions in markdown use LaTeX syntax wrapped in dollar sign delimiters. Inline math uses single dollar signs ($x^2$) and display math uses double dollar signs ($$). GitHub added native math rendering in 2022 using MathJax. Obsidian and Jupyter notebooks also support LaTeX math.
Try it in the editor
Paste your markdown and see subscript rendered instantly with professional themes.