Content · Web Development · HTML

HTML <sub> and <sup>: Subscripts and Superscripts

Sub lowers characters below the baseline, while sup raises them. These are useful in chemical formulas, mathematical notation, and footnote numbers.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

Sub lowers characters below the baseline, while sup raises them. These are useful in chemical formulas, mathematical notation, and footnote numbers.

What You Need to Know


Do not build general page layout with them. When precise mathematical meaning matters, MathML can be a better choice.

The goal is not to collect as many tags as possible. Pick the element that best describes what the content really is.

Example: See It in Action


Add this example to the appropriate part of a practice HTML page. Read each line before you open the page in your browser.

This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.

<p>Water is H<sub>2</sub>O.</p>
<p>Area: 4 m<sup>2</sup>.</p>
<p>Use superscript and subscript for meaningful notation.</p>

Let’s Understand the Example


  • Sub lowers text such as a chemical formula index.
  • Sup raises text such as an exponent or a footnote marker.
  • A p groups a paragraph of related text. Start another paragraph for a new thought.

Look for the text “Water is H” in the page. If the visible result surprises you, inspect the rendered elements to see what the browser actually built.

What Should You See?


The page should include “Water is H”. If it looks different from what you expected, open developer tools and compare the source with the elements the browser created.

Try removing one piece of markup in a scratch copy, refresh the page, and compare the behavior. This is often the fastest way to understand what that piece contributes.

Try It Yourself


  1. Write H2O with sub and x squared with sup.
  2. Save your changes, open or refresh the page, and compare the result with the original example.
  3. Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.

Common Beginner Mistakes


  • Using sup to make whole paragraphs smaller or aligned differently.
  • Avoid picking tags just for their default bold, italic or spaced appearance. Use CSS for presentation.

Key Takeaways


  • Sub lowers characters below the baseline, while sup raises them.
  • Sub lowers text such as a chemical formula index.
  • Do not build general page layout with them. When precise mathematical meaning matters, MathML can be a better choice.
Share this resourceSend this page to someone who may find it useful.