How to write superscript and subscript in markdown


How to write superscript and subscript in markdown

In this post, we will learn how to write superscripts and subscripts in markdown.

There is no native support for superscript (sup) and subscript (sub) in markdown.

However, if you are using a markdown compiler to render the content as HTML then we can use the <sub> tag for subscript and <sup> for superscript.

Let's see with an example.

Write superscript in markdown

To write superscript in markdown we will use the <sup> HTML tag.

This is <sup>superscript</sup> in markdown

Output:

This is superscript in markdown

Write subscript in markdown

To write subscript in markdown we can use the <sub> HTML tag.

This is <sub>subscript</sub> in markdown

Output:

This is subscript in markdown

You can also write the power of numbers in mathematical equations using HTML tags.

Write power of numbers in markdown

To write a mathematical equation with a power of number, we can use the superscript <sup> like this.

2<sup>2</sup> = 4

Output:

22 = 4

Note: You can also use the Unicode or emoji character directly on your markdown content if your OS support it.