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 water

Rendered: 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)d

For 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°F

Honestly, 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

CharDescriptionUnicode
¹Superscript 1U+00B9
²Superscript 2U+00B2
³Superscript 3U+00B3
Superscript nU+207F
Superscript +U+207A
Superscript -U+207B
Superscript 0U+2070
Superscript iU+2071

Common Subscript Characters

CharDescriptionUnicode
Subscript 0U+2080
Subscript 1U+2081
Subscript 2U+2082
Subscript 3U+2083
Subscript 4U+2084
Subscript nU+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

FeatureHTML TagsUnicode CharactersLaTeX Math
Superscript<sup>2</sup>²^2
Subscript<sub>2</sub>_2
CompatibilityNearly all platformsAll platformsNeeds math rendering
ComplexitySimpleSimplestRequires learning syntax
Best forGeneral useQuick notationComplex 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: