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

In LaTeX, you write superscript by placing a caret (^) before the character or group you want to raise. You write subscript by placing an underscore (_) before the character or group you want to lower. Both symbols work only in math mode — that is, between dollar signs ($...$) for inline math or between \[ and \] for display math.

For a single character, the syntax is straightforward: $x^2$ produces x squared, and $H_2O$ produces the subscript 2 in a water molecule. When you need more than one character in the superscript or subscript, you must wrap them in curly braces: $x^{10}$ raises 10 as a unit, while $x^10$ would raise only the 1 and leave the 0 at normal height.

You can also nest superscripts and subscripts. The expression $x^{2^3}$ produces x to the power of 2 to the power of 3. Similarly, $x_{i_j}$ produces a subscript i with its own subscript j. The order matters: $x^2_3$ and $x_3^2$ both work and produce the same visual result — a base with both a superscript and a subscript.

Key Takeaways

  • Use the caret symbol (^) for superscript and the underscore (_) for subscript, both only in math mode between dollar signs.
  • Wrap multiple characters in curly braces so they stay together: $x^{10}$ not $x^10$.
  • You can combine superscript and subscript on the same base, and nest them inside each other for complex expressions.
  • LaTeX automatically adjusts font size and spacing for superscripts and subscripts, so they look professional without manual formatting.

Single characters versus multiple characters

LaTeX treats a single character after ^ or _ as the entire superscript or subscript. If you type $x^2$, only the 2 is raised. If you type $x^23$, only the 2 is raised and the 3 sits at baseline height, which is usually not what you intend.

To raise or lower more than one character, enclose them in curly braces. The braces tell LaTeX to treat everything inside as a single unit. So $x^{23}$ raises both the 2 and the 3 together. This rule applies whether your superscript or subscript contains numbers, letters, or a mix: $e^{i\pi}$ raises both the i and π as a group.

Forgetting the braces is one of the most common mistakes. Your document will still compile, but the output will look wrong — characters will float at different heights instead of staying aligned as a unit.

Combining superscript and subscript on the same base

You can attach both a superscript and a subscript to the same base variable or symbol. The order in which you write them does not matter: $x^2_3$ and $x_3^2$ produce identical output, with 2 raised and 3 lowered on either side of x.

This is useful in chemistry and physics notation. For example, $^{238}_{92}U$ represents uranium-238 with atomic number 92 — the mass number as superscript and the atomic number as subscript on the left side of the element symbol. In this case, you place the superscript and subscript before the base symbol U.

If you need both on the right side, write them in either order: $U^{238}_{92}$ or $U_{92}^{238}$. LaTeX positions them correctly regardless. However, if you need a superscript on one side and a subscript on the other, you must use separate symbols or explicit positioning commands, which is less common in basic documents.

Nesting superscripts and subscripts

You can place a superscript or subscript inside another superscript or subscript. The most common case is an exponent of an exponent: $x^{2^3}$ means x to the power of (2 to the power of 3), which equals x to the power of 8. The inner 2^3 is wrapped in braces so it stays together as the exponent of x.

Subscripts can be nested the same way. The expression $a_{i_{j_k}}$ produces a with subscript i, which itself has subscript j, which itself has subscript k. Each level is smaller than the one above it, and LaTeX handles the sizing automatically.

When nesting, always use braces to group the inner expression. Write $x^{y^z}$, not $x^y^z$. The latter will produce an error because LaTeX does not know which ^ applies to which base.

Math mode requirements

Superscript and subscript symbols only work inside math mode. If you type x^2 in regular text (outside dollar signs), LaTeX will either ignore the ^ and _ or produce an error, depending on context. You must enclose the expression in dollar signs to enter math mode.

For inline math — expressions that sit within a sentence — use single dollar signs: The formula is $E=mc^2$ in physics. For display math — equations on their own line — use \[ and \]: \[E=mc^2\] or use the equation environment. Both approaches work with superscript and subscript.

If you forget the dollar signs, your document will compile but the output will show the raw symbols (^ and _) instead of raising or lowering text. This is a visual error, not a compilation error, so it can be straightforward to miss.

Common mistakes and how to fix them

The most frequent error is forgetting braces around multi-character superscripts or subscripts. If you write $x^10$ when you mean x to the 10th power, only the 1 is raised. The fix is straightforward: change it to $x^{10}$.

Another common mistake is using superscript or subscript outside math mode. If you write H_2O without dollar signs, the underscore will not lower the 2. You must write $H_2O$ for it to work. Some text editors highlight this visually, but LaTeX will still compile — it just will not produce the formatting you want.

A third mistake is trying to use ^ or _ in text mode to create superscript or subscript for non-mathematical content, like trademark symbols or footnote markers. LaTeX has different commands for those: \textsuperscript{} and \textsubscript{} work in text mode and do not require dollar signs. For example, Company\textsuperscript{®} produces a registered trademark symbol in superscript without entering math mode.

Frequently Asked Questions

Do I need to use curly braces for a single character?

No. A single character after ^ or _ is automatically treated as the superscript or subscript. $x^2$ works fine. However, using braces does no harm: $x^{2}$ produces the same result. Many writers use braces consistently for clarity and to avoid mistakes when editing.

Can I use superscript and subscript in text mode without math mode?

Not with ^ and _. Those symbols only work in math mode. For text-mode superscript and subscript, use \textsuperscript{} and \textsubscript{}. For example, E=mc\textsuperscript{2} produces E=mc² in regular text without dollar signs.

What if I need a superscript on the left side of a symbol?

Write the superscript before the symbol: $^{238}U$ places 238 as a superscript to the left of U. This is standard in nuclear chemistry notation. You can also add a subscript: $^{238}_{92}U$ for uranium-238 with atomic number 92.

How do I make superscript or subscript larger or smaller?

LaTeX automatically sizes superscripts and subscripts smaller than the base text. You cannot easily change this without advanced commands. If you need custom sizing, you can use \displaystyle inside the superscript or subscript to force normal-size text, but this is rarely necessary and usually makes equations look wrong.

Can I have multiple levels of superscript or subscript?

Yes. You can nest them as deeply as you need: $x^{y^{z^w}}$ is valid. Each level is automatically sized smaller. However, deeply nested expressions become hard to read, so use them sparingly.