Markdown Superscript and Subscript: A Complete Guide
Markdown doesn't have built-in superscript or subscript syntax — unlike bold and italic, there are no dedicated markers for these. You'll need to use HTML tags or Unicode characters instead.
This article covers the main ways to handle markdown superscript and markdown subscript, plus a Unicode character cheat sheet you can copy and paste from.
Using HTML Tags (Most Common)
This is the most widely supported approach. Since Markdown supports inline HTML, you can use the <sup> and <sub> tags directly:
Superscript <sup>
x<sup>2</sup> + y<sup>2</sup> = z<sup>2</sup>Rendered: x2 + y2 = z2
Subscript <sub>
H<sub>2</sub>O is the chemical formula for waterRendered: H2O is the chemical formula for water
The syntax is straightforward — just wrap the content you want raised or lowered in the appropriate tag. Most Markdown platforms support these HTML tags since they're basic HTML elements.
Common Use Cases
Knowing the syntax is one thing; knowing when to use it is another. Here are some practical scenarios:
Chemical Formulas
Chemical formulas are the most common use case for subscripts:
- Water: H<sub>2</sub>O
- Carbon dioxide: CO<sub>2</sub>
- Sulfuric acid: H<sub>2</sub>SO<sub>4</sub>
- Sulfate ion: SO<sub>4</sub><sup>2-</sup>Rendered:
- Water: H2O
- Carbon dioxide: CO2
- Sulfuric acid: H2SO4
- Sulfate ion: SO42-
Notice the sulfate ion — subscript and superscript can be combined by placing <sub> and <sup> right next to each other.
Math Equations
- Area: A = πr<sup>2</sup>
- Volume: V = 4/3πr<sup>3</sup>
- Sequence formula: a<sub>n</sub> = a<sub>1</sub> + (n-1)dFor more complex equations, LaTeX math syntax (covered below) is usually the better choice.
Trademarks and Symbols
- Registered trademark: Markdown<sup>®</sup>
- Trademark: Coca-Cola<sup>™</sup>
- Copyright: © 2024
- Temperature: 25°C or 77°FHonestly, for trademark symbols, using Unicode characters directly is less verbose than HTML tags — there's a cheat sheet below.
Citation Markers
See the 3<sup>rd</sup> edition of "Design Patterns"But if your citation needs clickable jump links (like academic references), you should use Markdown footnotes instead of <sup>. Footnotes auto-number and link to the bottom of the page — superscript tags can't do that.
Using Unicode Characters (Zero Dependencies)
Many superscript and subscript characters have Unicode equivalents. You can just copy and paste them — no HTML tags needed.
Common Superscript Characters
| Char | Description | Unicode |
|---|---|---|
| ¹ | Superscript 1 | U+00B9 |
| ² | Superscript 2 | U+00B2 |
| ³ | Superscript 3 | U+00B3 |
| ⁿ | Superscript n | U+207F |
| ⁺ | Superscript + | U+207A |
| ⁻ | Superscript - | U+207B |
| ⁰ | Superscript 0 | U+2070 |
| ⁱ | Superscript i | U+2071 |
Common Subscript Characters
| Char | Description | Unicode |
|---|---|---|
| ₀ | Subscript 0 | U+2080 |
| ₁ | Subscript 1 | U+2081 |
| ₂ | Subscript 2 | U+2082 |
| ₃ | Subscript 3 | U+2083 |
| ₄ | Subscript 4 | U+2084 |
| ₙ | Subscript n | U+2099 |
| ₊ | Subscript + | U+208A |
| ₋ | Subscript - | U+208B |
Just copy and paste:
H₂O and CO₂ without any HTML tags
x² + y² = z²
E = mc²This is the easiest approach, but Unicode coverage is limited — you might not find the right character for complex formulas.
Using LaTeX Math Syntax
For complex formulas (fractions, integrals, square roots), LaTeX math syntax is the way to go. Most Markdown platforms that support math rendering also support LaTeX:
Inline: $H_2SO_4$ and $x^2 + y^2 = z^2$
Block:
$$
\sum_{i=1}^{n} a_i = a_1 + a_2 + \cdots + a_n
$$- Superscript uses
^:x^2→ x² - Subscript uses
_:H_2O→ H₂O
LaTeX is the most professional option for math and chemistry, but it requires a platform with math rendering support. GitHub doesn't support LaTeX; Obsidian and Typora do.
Choosing the Right Approach
| Feature | HTML Tags | Unicode Characters | LaTeX Math |
|---|---|---|---|
| Superscript | <sup>2</sup> | ² | ^2 |
| Subscript | <sub>2</sub> | ₂ | _2 |
| Compatibility | Nearly all platforms | All platforms | Needs math rendering |
| Complexity | Simple | Simplest | Requires learning syntax |
| Best for | General use | Quick notation | Complex formulas |
My personal habit:
- Simple chemistry and math (H₂O, x²) → Unicode characters, just copy and paste
- Need to guarantee cross-platform display → HTML tags
- Complex formulas (integrals, fractions, matrices) → LaTeX
Why Markdown Has No Native Syntax
You might wonder why superscript and subscript don't have their own syntax markers like Markdown bold and Markdown italics. The reason is CommonMark's design philosophy — John Gruber's original Markdown spec never included superscript or subscript, and the CommonMark spec followed suit. The reasoning: these are used far less frequently than bold and italic, and the HTML tags <sup> and <sub> are simple enough that adding dedicated syntax would be unnecessary complexity.
This topic has come up many times in the CommonMark community, and the consensus has been consistent: native superscript and subscript syntax will not be added.
Common Questions
Do <sup> and <sub> work on GitHub?
Yes. GitHub supports both HTML tags. However, GitHub doesn't support LaTeX math rendering, so you'll need a different approach for complex formulas.
Will Unicode characters fail to display on some platforms?
Generally no. Superscript and subscript Unicode characters are part of the standard character set and render fine in modern browsers and editors. Very old systems might have issues with a few rare characters, but this is uncommon.
What's the difference between superscript tags and footnotes?
<sup> only displays text as superscript — no linking functionality. Markdown footnotes [^1] auto-number, create jump links, and collect at the bottom of the page. For academic citations, use footnotes. If you just need a small raised number or symbol, <sup> is sufficient.
Sources:
- Markdown Guide - Superscripts and Subscripts (Authoritative Markdown community reference)
- Stack Overflow - Superscript in Markdown (Top-voted answer)
- CommonMark - Why no subscript/superscript syntax (Design discussion)
- dev.to - Superscript and Subscript with Markdown (Method comparison)