Skip to content
All Markdown syntax

Superscript and subscript in Markdown

Text

Markdown syntax

Needs HTML
x<sup>2</sup>

Superscript with HTML. Works on GitHub.

CommonMark has no superscript or subscript. The HTML tags <sup> and <sub> are the portable choice; for anything that is really a formula, math notation gives better results.

All ways to write it

  • x<sup>2</sup>
    Superscript with HTML. Works on GitHub.Needs HTML
  • H<sub>2</sub>O
    Subscript with HTML.Needs HTML
  • x^2^ and H~2~O
    Pandoc and some editors (Typora, markdown-it plugins).Some tools only
  • $x^2$ and $H_2O$
    Math, in tools that render it. Use for formulas.Some tools only

Example

You type

E = mc<sup>2</sup>, and water is H<sub>2</sub>O.

See the footnote<sup>1</sup>.

You get

E = mc2, and water is H2O.

See the footnote1.

Questions

Does ^text^ work on GitHub?

No. GitHub shows the carets as typed. Use <sup>text</sup>.

How do I write a footnote marker?

Use real footnote syntax, text[^1], where the tool supports it; it numbers and links the note for you. See the footnotes page.

Superscript, subscript in Confluence

For formulas, Markdown Macro+ renders $x^2$ and $H_2O$ with KaTeX. Outside the macro, LaTeX Math for Confluence adds inline and block equations to any page.

Related syntax

Also in Text

See all Markdown syntax