Skip to content

HTML <sup> tag

The <sup> tag is used to define superscript text, which appears half a character above the regular line and is rendered smaller than the rest of the text. The tag is commonly used to define footnotes and formulas.

You must use the <sup> tag only for typographical reasons. It shouldn’t be used for styling purposes. If you want to change the vertical position of text, you can use the CSS vertical-align property with the super value.

TIP

The <sub> tag is used to define the subscript.

Here are some use cases for a <sup> element:

  • Representing superior lettering in certain languages or abbreviations.
  • Representing exponents (e.g. "x2.").
  • Representing ordinal numbers (e.g. "5th" instead of "fifth").

Note: Use superscript text only for typographical purposes. Avoid using it to hide important information, as assistive technologies may skip or mispronounce it.

Syntax

The <sup> tag comes in pairs. The content is written between the opening (<sup>) and closing (</sup>) tags.

Example of the HTML <sup> tag:

HTML <sup> tag

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <p>
      E = mc<sup>2</sup>, where E is the energy of the object, m is the weight, c is the light speed in vacuum.
    </p>
  </body>
</html>

Result

 sup example

Example of the HTML <sup> tag used with the CSS vertical-align property:

Example of the HTML <sup> tag

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      sup {
        vertical-align: super;
        font-size: medium;
      }
    </style>
  </head>
  <body>
    <h1>Example of the sup tag</h1>
    <p>
      Here is some text <sup>with the sup tag</sup>.
    </p>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis ...
    </p>
    <p>
      Reference site about Lorem Ipsum,
      <sup>giving information on its origins</sup>, as well as a random Lipsum generator.
    </p>
  </body>
</html>

Example of the HTML <sup> tag used with the <sub> tag:

Example of the HTML <sup> tag with the <sub> tag

html
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      sup {
        vertical-align: super;
        font-size: medium;
      }
      
      sub {
        vertical-align: sub;
        font-size: small;
      }
    </style>
  </head>
  <body>
    <h1>Example of the sup and sub tags</h1>
    <p>
      Here is some text
      <sub>with the sub tag</sub>.
    </p>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis ...
    </p>
    <p>
      Reference site about Lorem Ipsum,
      <sup>giving information on its origins</sup>, as well as a random Lipsum generator.</p>
  </body>
</html>

Attributes

The <sup> tag supports Global attributes and the Event Attributes.

Practice

What is the correct usage and purpose of the HTML <sup> tag?

Dual-run preview — compare with live Symfony routes.