HTML <sup> Tag

Beginner
5 min read
Updated: Nov 2026
4 examples
Live preview

Definition and Usage

The <sup> element marks inline text that should appear as a superscript for typographical reasons. Browsers typically raise the baseline and use slightly smaller text.

Good fits: exponents (x2), ordinals (5th), and superior lettering in some languages. For lowered text use <sub>. For decoration-only raising use CSS vertical-align, not <sup>.

Baseline · Widely available.

Not deprecated and not experimental. Stable across modern browsers since about July 2015.

Typography, not decoration.

Use <sup> when convention calls for a superscript. Do not use it only to raise letters in a logo or heading.

HTML Syntax

syntax.html
<sup> superscript text</sup>

Both start and end tags are required. Content is phrasing content (text and inline elements).

Attributes

<sup> has no element-specific attributes. Use globals when needed:

AttributeDescriptionTry it
classOptional CSS hook if you restyle superscriptsTry it
idUnique identifier for linking or scriptingGlobal attr
titleAdvisory text (tooltip). Rarely needed on supOptional

Global Attributes

The <sup> tag also supports the Global Attributes in HTML.

Live Preview

Switch common superscript uses and see how <sup> reads in context.

Real <sup> markup for typographical superscripts.

Result

E = mc2

Exponent — power of a number in superscript.

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Exponents

Wrap the power in <sup>. Pair with <var> for math variables.

HTML
<p>
  <var>E</var> = <var>m</var><var>c</var><sup>2</sup>
</p>
<p>
  <var>a<sup>2</sup></var> +
  <var>b<sup>2</sup></var> =
  <var>c<sup>2</sup></var>
</p>
Try It Yourself

How It Works

  1. Write the base as normal text or inside <var>.
  2. Wrap the exponent in <sup>…</sup>.
  3. Keep both tags — start and end are required.
  4. For complex formulas, consider MathML instead of many nested tags.

Example 2 — Ordinal Numbers

Abbreviate ordinals with a numeral plus a superscript suffix.

HTML
<ul>
  <li>English: 5<sup>th</sup></li>
  <li>French: 5<sup>ème</sup></li>
</ul>
Try It Yourself

How It Works

  1. Write the number as normal text.
  2. Wrap the suffix (th, ème, …) in <sup>.
  3. Match the language — ordinal forms differ by locale.
  4. Keep the suffix short so the line stays readable.

Example 3 — Superior Lettering

Some languages abbreviate with raised letters. HTML commonly uses <sup> for that look.

HTML
<p>
  Robert a présenté son rapport à M<sup>lle</sup> Bernard.
</p>
Try It Yourself

How It Works

  1. Write the base letters (here, M).
  2. Wrap the superior part in <sup>.
  3. Use this for language conventions, not random decoration.
  4. Do not use sup just to style a brand wordmark.

Example 4 — sub vs sup

Subscript lowers; superscript raises. Use the one that matches the convention.

HTML
<p>Water: H<sub>2</sub>O</p>
<p>Squared: x<sup>2</sup></p>
Try It Yourself

How It Works

  1. First line: atom count uses <sub>.
  2. Second line: exponent uses <sup>.
  3. Same idea, opposite direction — lower vs raise.
  4. Pick by convention, not by whichever looks smaller.

Edge Cases & Pitfalls

Most mistakes use sup as a style knob instead of a typographical mark.

decoration

Not for logos or layout tricks

If you only want raised letters for looks, use CSS vertical-align. Save <sup> for real superscripts.

vs sub

Do not swap with sub

Atom counts and indices usually need <sub>. Exponents and ordinals usually need <sup>.

math

Complex math may need MathML

Simple powers work with sup. Large formulas are clearer with MathML than many nested HTML tags.

a11y

Implicit role is superscript

Assistive tech can expose superscript. Keep the content short so spoken math stays clear.

nesting

Avoid deep nesting

Do not stack many sub / sup levels for layout. Prefer a formula language when structure gets heavy.

Browser Support

The <sup> element is core HTML in every browser. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

<sup>

Widely available since about July 2015 (and long before as superscript). Chrome, Firefox, Safari, Edge, and Opera all support it fully.

98% Global support (approx.)
Google Chrome All
Full support
Mozilla Firefox All
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All
Full support
Internet Explorer All
Supported
<sup> Widely supported

Bottom line: Safe to use everywhere for typographical superscripts. Choose sup or CSS by meaning — not only by the raised look.

Key Takeaways

  • Role: <sup> marks typographical superscripts.
  • Use for: exponents, ordinals, and superior lettering.
  • Compare: sub lowers text; CSS raises for decoration only.
  • Pairing: <var>x<sup>2</sup></var> is a common math pattern.

One line: use <sup> when typography needs a real superscript — not just smaller raised text.

Default CSS Settings

Typical user-agent styling (browsers may add more details):

default.css
sup {
  vertical-align: super;
  font-size: smaller;
}

You may restyle sup with CSS, but keep it clearly raised so exponents and ordinals stay readable.

Frequently Asked Questions

The sup element marks inline text that should appear as a typographical superscript — for example exponents, ordinal suffixes, or superior lettering in some languages.
Visually they can look similar. Use sup when the superscript is part of typographical convention. Use CSS when you only want a raised look for decoration or branding.
sub lowers text (subscript). sup raises text (superscript). Pick the one that matches the convention — for example H2O uses sub; x² uses sup.
No. sup only supports the global attributes, such as class, id, and lang.
No. That is presentation. Style the logo with CSS (for example vertical-align) instead of sup.
Yes. A common math pattern is <var>x<sup>2</sup></var> for a squared variable.

Next: svg

Learn how to embed scalable vector graphics in HTML.

svg tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful