HTML Superscript and Subscript

Superscript

The HTML <sup> tag is used to create superscript text. The text inside the <sup> tag is rendered half a character above the normal line and has a smaller font size. For example,

<p> This is a <sup>Superscript</sup> text.</p>

Browser Output

HTML Superscript text

Usage of Superscript

Superscript text is generally used for exponents, measurement units, and ordinal numbers. For example,

1. Superscript in exponents

<p> a<sup>2</sup> + b<sup>2</sup> = c<sup>2<sup></p>

Browser Output

Exponents written in superscript

2. Superscript in measurement units

<p>The area of this park is 200m<sup>2</sup>.</p>

Browser Output

Units of measurement written in superscript

3. Superscript in ordinal numbers

<p>Ram scored 1<sup>st</sup> position in the 100m race.</p>

Browser Output

Ordinal position written in superscript

Subscript

The HTML <sub> tag is used to create subscript text. The text inside the <sub> tag is rendered half a character below the normal line and has a smaller font size. For example,

<p> This is a <sub>Subscript</sub> text.</p>

Browser Output

HTML Subscript text

Usage of Subscript

Superscript text is generally used for mathematics and chemical formulas. For example,

1. Usage in Mathematical Formula

<p> <var>x<sub>1</sub></var> … <var>x<sub>n</sub></var></p>

Browser Output

Mathematic formula written in subscript

2. Usage in Chemical Formula

<p> H<sub>2</sub>SO<sub>4</sub> is chemical formula for sulphuric acid.</p>

Browser Output

Chemical formula written in subscript

Your builder path starts here. Builders don't just know how to code, they create solutions that matter.

Escape tutorial hell and ship real projects.

Try Programiz PRO
  • Real-World Projects
  • On-Demand Learning
  • AI Mentor
  • Builder Community