Teaching and Learning with Technology

Computing With Accents and Foreign Scripts

Skip Menu

Superscript and Subscript

There are several approaches to displaying superscript and subscript text on the Web, and each have their uses depending on your needs.

Page Contents

  1. MathML and Accessibility
  2. HTML and CSS
  3. Using Unicode Values
  4. Unicode Chart - New Page

MathML and Accessibility

If the superscript or subscript character is part of a mathematical equation, MathML markup is the most accessible, especially for blind users on a screen reader.

See the Penn State Accessibility MathML page for more information.

If MathML is not the right solution, there are some additional options to consider below.


For most purposes, you can use the <sup></sup> tag to create super script text and <sub></sub> to create sub-script text. See examples below:

Code: x<sup>x+1</sup>
Result: xx+1

Code: x<sub>i+1</sub>
Result: xi+1

Note: Although some Web standards professionals recommend avoiding these tags, they are part of the HTML 5 and XHTML standards.

CSS Styles and the SUP/SUB Tags

You change the CSS attributes of the <sup> and <sub> tags to improve line spacing, formatting and placement of characters. See references below:

Note: If you wish to avoid <sup> and <sub> because they are presentational, you can use sizing and vertical alignment CSS with <span> or another appropriate tag.

Using Unicode Values

Many common superscript and subscript characters have their own Unicode entries and entity codes. If your Web page is generated from a database or meant to be a searchable archive, the use of Unicode values may be preferable.

Top of Page

Tuesday, 28-Mar-2017 14:58:39 EDT