Superscript in HTML, Explained

Download Now: Free HTML & CSS Coding Templates
Danielle Richardson Ellis
Danielle Richardson Ellis



Like me, you probably had your first encounter with a superscript character in a middle school math class -- except they probably were called "exponents."

html superscript illustration

These elevated little numbers are not only used in math equations, but also for copyright symbols, footnotes, and monetary values. Needless to say, you might need to include them on your website, and fortunately, doing that via HTML is a lot easier than passing middle school math. 

Download Now: 50 Code Templates [Free Snippets]

Let's start with the basics -- what superscripts are and how you can use them in HTML. Then I'll walk you through a few examples and wrap things up with some do's and don'ts.

The Basics of Superscripts in HTML

First things first, let's break down what a superscript is.

To create a superscript character in HTML, we'll use the <sup> tag. All you need to do is enclose the text that you want to superscript within the <sup> and </sup> tags. Take a look at the example below:

<p>This is HTML superscript<sup>101</sup></p>

This would render as: This is HTML superscript¹⁰¹. Notice the 101? It's now sitting at the top of the typography line.

Let's look a few more examples.

Examples of Superscript in HTML

Below are not only examples of superscript characters in HTML, but also scenarios where you might want to use them for web development. Feel free to copy and edit the code as needed.

Example 1: Footnotes

Footnotes provide contextual information about a subject without interrupting the flow of a blog post or web article. The superscript character is typically a number and it appears at the end of a sentence. At the bottom page the same superscript character is featured alongside a more detailed explanation of the topic.

Code example:

<p>This is a fascinating fact<sup>1</sup>.</p>

Here's what this might look like if we added some additional text around it:

example of superscript in HTML: footnote

Best for: Academic articles, research papers, literary critiques, or any content rich with references and supplementary information.

Example 2: Mathematical Expressions

We already touched on these at the beginning of this post, but superscripts are often used in mathematical expressions to represent exponents.

Code example:

<p>E = mc<sup>2</sup></p>

Again, here is what our code looks like in action:

example of superscript in html: math

Best for: Academic content, math blogs and tutorials, where explaining complex concepts requires precision.

This video goes into more detail on how to markup mathematical expressions with superscript in HTML.

Example 3: Abbreviations and Dates

Superscripts can also be used for abbreviations and dates. The example below is probably the most common use in this case.

Code example:

<p>19<sup>th</sup> Century</p>

Using a superscript here makes your text look much more professional -- which you might be aiming for if you're writing about historical topics on your site.

Here's what the above code would look like:

example of superscript in HTML: abbreviations and dates

Best for: Historical articles, formal writings, and documents where showcasing dates and abbreviations accurately matter.

The Dos & Don'ts of Using HTML Superscripts

Before we wrap things up, let's go over a few do's and don't that you'll want to keep in mind when using superscript characters in HTML.

Do: Keep it Readable

Superscript characters can make your text look more professional, but it's more important that you content is readable. You may want to forgo the use of superscript characters if you notice that the output is tougher to read with them then without them.

One example could be if your using a stylized font where superscripts don't render the same as they do with other fonts. In the example below, I prefer the bottom option where there is no superscript because it's more readable that the top.

example superscript in html

Pro tip: Always preview your content to ensure that the superscripts are easily readable across different devices and screen sizes.

Don't: Overuse It

This falls under the same umbrella as readibility. Now, your content might actually call for a high volume of superscript characters -- and that's fine so long as its readible.

But, if you're using so many superscripts to the point that it's tough to read your content, then you should look for an alternative way to style your text.

Pro tip: Let superscripts be the cherry on the cake, accentuating the content without overwhelming the reader with too many elevated characters.

Do: Use It for Proper References

Whether you're using it for footnotes, math equations, or a special use case of your own, make sure that you use superscripts consistently and with the proper referances.

For example, it's easy to confuse superscripts with subscripts. They're both minaturized characters, but superscripts are elevated while subscripts are positioned at the bottom of the typography line. Make sure you have the right one for your use case or you might confuse readers accidentally. 

Pro tip: Pair your superscripts with a well-organized reference list at the end of your document. This not only ensures accuracy, but it also facilitates easy access to detailed sources for your readers.

Don't: Ignore Consistency

As with any element in content creation, maintaining a consistent style is key. The usage of superscripts should follow a uniform pattern throughout your content, be it in denoting footnotes, highlighting a specific term, or showcasing a mathematical expression.

This not only creates a cohesive look but also builds a stronger brand identity through the presentation of your content. After all, it's better for readers to develop an expectation for your interface. Not only does this make it easier to navigate your site, but it also creates a more habitual experience that encourages folks to come back for more. Little details like superscripts are just one of many factors that can contribute to a more consistent experience on your site.

Pro tip: Develop a style guide for your HTML superscripts to ensure consistency across different content pieces, fostering a recognizable and trustworthy brand image.

Signing Off With Superscripts

Superscripts are a handy text-editing tool and with a little practice, they're not too hard to implement in HTML. Keep in mind the do's and don'ts we highlighted above and you'll be in a great position to leverage superscripts in your content creation going forward.

New Call-to-action

Topics: HTML

Related Articles

We're committed to your privacy. HubSpot uses the information you provide to us to contact you about our relevant content, products, and services. You may unsubscribe from these communications at any time. For more information, check out our Privacy Policy.


Dozens of free coding templates you can start using right now

CMS Hub is flexible for marketers, powerful for developers, and gives customers a personalized, secure experience