👀 Live Preview
Exponent notation with superscript power:
23 = 8

The <sup> tag renders superscript text above the baseline. This guide covers syntax, exponents, ordinal numbers, footnotes, sup vs sub, accessibility, and best practices for beginners.
Text above the baseline.
23 and power notation.
1st, 2nd, 3rd.
Inline opening and closing tags.
Above vs below baseline.
Semantic, accessible markup.
<sup> Tag?The <sup> tag is an HTML element used to render text in a superscript style. Superscripted text appears slightly above the baseline and is commonly used for exponents, ordinal suffixes, footnote markers, and chemical charges.
Use sup when characters genuinely belong above the line, such as the 3 in 23. For subscript (below the line), use <sub> instead.
The sup element is inline and flows naturally inside paragraphs, headings, and other text content without breaking the line.
Enclose the superscript content within opening and closing sup tags:
<sup>Your superscripted text here</sup><p>2<sup>3</sup> is equivalent to 2 * 2 * 2.</p>sup is phrasing content — use inline inside block elements like p or td.<sup />) is not valid in HTML.| Topic | Code Snippet | Notes |
|---|---|---|
| Basic sup | <sup>...</sup> | Superscript |
| Exponent | 2<sup>3</sup> | Powers |
| Ordinal | 1<sup>st</sup> | Ranking |
| vs sub | sup = above | sub = below |
| Footnotes | <sup>1</sup> | Standard convention |
| Browser support | Universal | All browsers |
<sup> vs <sub>| Element | Position | Common uses |
|---|---|---|
<sup> | Above baseline (superscript) | 23, 1st, footnote1 |
<sub> | Below baseline (subscript) | H2O, A1, CO2 |
| Appearance | Both smaller than surrounding text | Browser default typography |
| Footnotes | sup is standard | sub for true subscript only |
The <sup> tag has no tag-specific attributes. Combine it with global attributes for styling when needed.
<p>This is normal text<sup class="small-text" style="color: #007bff;">styled superscript</sup> in a sentence.</p>class / id GlobalHook for CSS targeting superscript styling in formulas or footnotes.
class="superscript"style GlobalInline font-size or color tweaks for footnote markers.
style="color: #007bff"title OptionalTooltip explaining a superscript symbol or footnote reference.
title="Footnote 1"lang OptionalDeclare language when superscript text differs from the page.
lang="en"Exponents, ordinal numbers, and footnote markers with copy-ready code and live previews.
Exponent notation with superscript power:
23 = 8
Use <sup> for exponents, ordinal suffixes, footnote markers, and any text that belongs above the baseline.
The sup tag is commonly employed in mathematical expressions to denote exponents or powers:
<p>2<sup>3</sup> is equivalent to 2 * 2 * 2.</p>Use the sup tag to display ordinal suffixes in a visually distinct manner:
<p>The 1<sup>st</sup>, 2<sup>nd</sup>, and 3<sup>rd</sup> places.</p>Enhance readability by placing footnote reference numbers in superscript:
<p>This is a sentence with a footnote<sup>1</sup>.</p>sup to the corresponding note with id and href.Characters that belong above the baseline go inside sup.
Default styles render text smaller and above the baseline.
23 and 1st display with proper scientific and typographic convention.
Mathematical, ordinal, and footnote content is visually accurate and semantically correct.
The <sup> tag is supported in all major browsers, including Internet Explorer.
All browsers render <sup> with superscript typography by default.
Bottom line: Use <sup> confidently for superscript text in any browser.
Mastering the <sup> tag helps you present superscripted text with precision. Whether writing exponents, ordinal numbers, or footnotes, sup enhances visual clarity and semantic accuracy in your HTML documents.
sup for genuine superscript content like 23sup for footnote reference numberssub for subscript and chemical formula indicessup for decorative positioning without meaningsupsup when sub is the correct notation<sup>Bookmark these before you write superscript text on your pages.
Above baseline.
PurposeExponents.
Use caseOrdinals.
PatternAbove vs below.
ComparisonMeaningful use.
A11yAll browsers.
Compatibilitysup places text above the baseline. sub places text below it, such as chemical formula indices.class, id, and style.sup, for example: This sentence1.Practice <sup> for exponents, ordinals, and footnotes in the Try It editor.
6 people found this page helpful