Superscript and subscript in LaTeX use the caret (^) and underscore (_) symbols

In LaTeX, superscript appears above the baseline of text — like the "2" in x². Subscript appears below — like the "2" in H₂O. You create superscript by typing a caret (^) followed by the character or group you want raised. You create subscript by typing an underscore (_) followed by what you want lowered. Both symbols tell LaTeX to treat the next character or group as positioned differently from regular text.

The key difference between these and regular text is positioning, not size. LaTeX automatically shrinks superscript and subscript text slightly, but the real change is where it sits on the line. This matters in math mode (inside dollar signs) and in regular text, though the behavior differs slightly between the two.

Key Takeaways

  • Use the caret symbol (^) for superscript and underscore (_) for subscript, followed immediately by the character or group you want positioned.
  • Wrap multiple characters in curly braces — x^{2} and H_{2}O — so LaTeX treats them as a single unit.
  • Superscript and subscript work in both math mode (between dollar signs) and regular text, but math mode is where they appear most often.
  • You can nest superscript and subscript — for example, x^{2^{3}} creates x with 2³ as the superscript.
  • In regular text outside math mode, superscript and subscript may look less polished than in math mode, where they are designed to sit naturally.

Superscript in math mode

In math mode (text between dollar signs), superscript is the most common use. Type $x^2$ to get x². The caret tells LaTeX to raise what comes next. If you want only one character raised, you can type it directly after the caret: $x^2$ or $2^n$. LaTeX handles the positioning and sizing automatically.

When you need more than one character in the superscript, wrap it in curly braces. Type $x^{10}$ to get x¹⁰, not x¹ followed by a 0. Without the braces, LaTeX raises only the 1 and leaves the 0 in regular position. The same rule applies to any multi-character superscript: $e^{i\pi}$, $2^{n+1}$, or $x^{\text{th}}$.

Subscript in math mode

Subscript uses the underscore (_) and follows the same rules as superscript. Type $H_2O$ to get H₂O. For a single character, you can type it directly: $a_1$ or $x_n$. LaTeX lowers the character and shrinks it slightly to match the style of math mode.

For multiple characters, use curly braces: $a_{10}$ gives a₁₀, not a₁ followed by 0. This is especially important in chemistry and physics, where subscripts often have multiple digits or letters. Type $\text{H}_2\text{SO}_4$ for sulfuric acid, or $x_{i,j}$ for a matrix element with two indices.

Combining superscript and subscript

You can use both on the same base character. Type $x_1^2$ or $x^2_1$ — the order does not matter, and LaTeX positions both correctly. The result shows x with a subscript 1 and superscript 2. If either the subscript or superscript has multiple characters, wrap it in braces: $x_{10}^{2}$ or $a_i^{n+1}$.

You can also nest superscript and subscript. Type $x^{2^3}$ to get x with 2³ as the superscript — the inner caret raises the 3 above the 2. Nesting works the other way too: $x_{a_b}$ creates a subscript with its own subscript. Use braces carefully when nesting to make sure LaTeX understands which symbols belong to which level.

Superscript and subscript in regular text

Outside math mode, superscript and subscript still work but look different. In regular text, type E=mc\textsuperscript{2} to get E=mc². The command \textsuperscript{} raises text above the baseline. For subscript in regular text, use \textsubscript{}: H\textsubscript{2}O gives H₂O.

These commands are less common than using math mode because they do not shrink the text as much and do not align as naturally with regular letters. If you are writing a chemical formula or mathematical expression in a sentence, it is usually better to use math mode: The formula is $H_2O$ rather than mixing text commands. Math mode was designed for this purpose and produces cleaner results.

Common mistakes and how to fix them

The most frequent error is forgetting braces around multi-character superscripts or subscripts. If you type $x^10$, LaTeX raises only the 1, leaving the 0 behind. Always use $x^{10}$ when you have more than one character. The same applies to subscripts: $a_10$ is wrong, $a_{10}$ is correct.

Another common issue is trying to use superscript or subscript outside math mode without the proper command. Typing x^2 in regular text does not work — LaTeX treats the caret as a regular character. You must either enter math mode with dollar signs ($x^2$) or use \textsuperscript{2}. Similarly, H_2O in regular text will not produce subscript; you need $H_2O$ or H\textsubscript{2}O.

When to use math mode versus text commands

Use math mode (dollar signs) for any mathematical expression, variable, or number that represents a quantity. This includes exponents, chemical formulas, and scientific notation. Math mode automatically handles spacing, sizing, and alignment in a way that looks professional and reads clearly. It is the standard in academic and technical writing.

Use text commands like \textsuperscript{} only when you need superscript or subscript in regular prose and cannot use math mode — for example, when writing ordinal numbers like "1st" or "2nd" in a sentence. Even then, many writers prefer to spell these out. For anything mathematical or scientific, math mode is the better choice because it is designed for that purpose and produces more consistent results across different documents and readers.

Frequently Asked Questions

Do I need to load a package to use superscript and subscript?

No. The caret and underscore work in math mode without any extra packages. For text commands like \textsuperscript{} and \textsubscript{}, you need the fixltx2e package in older LaTeX versions, but modern LaTeX includes these commands by default. Check your LaTeX distribution documentation if the commands do not work.

Can I make superscript or subscript larger or smaller?

LaTeX automatically sizes superscript and subscript to be smaller than the base text. You can manually change the size using commands like $x^{\large 2}$, but this breaks the visual hierarchy and is rarely necessary. The automatic sizing is designed to look correct, so it is best to leave it alone unless you have a specific reason to change it.

What if I want superscript or subscript on both sides of a character?

LaTeX does not support this directly because it is rarely needed in standard mathematics. If you need it, you can use the tensor package or manually position elements using other commands. For most purposes, rearranging your notation to avoid this situation is simpler and produces clearer results.

How do I write a superscript or subscript that contains a fraction?

Use the \frac{} command inside the braces: $x^{\frac{1}{2}}$ gives x to the one-half power. LaTeX automatically sizes the fraction to fit inside the superscript. The same works for subscripts: $a_{\frac{i}{2}}$.