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

In LaTeX, superscript (raised text like exponents or footnote markers) uses the caret symbol ^, and subscript (lowered text like chemical formulas) uses the underscore _. Both work in math mode and text mode, though the syntax differs slightly depending on where you use them. A single character after the symbol becomes superscript or subscript; multiple characters need curly braces.

The most common mistake is forgetting braces when you have more than one character. Writing x^10 produces only the 1 as superscript, leaving the 0 in normal position. Writing x^{10} raises both digits together.

Key Takeaways

  • Use ^ for superscript and _ for subscript; both require math mode or the \textsuperscript and \textsubscript commands in text.
  • Single characters do not need braces, but multiple characters must be wrapped in curly braces: x^{2} and H_{2}O.
  • Combine superscript and subscript on the same base by using both symbols: x_{i}^{2} or x^{2}_{i} (order does not matter).
  • In text mode outside math, use \textsuperscript{} and \textsubscript{} instead of ^ and _ to avoid errors.

Superscript in math mode

Inside dollar signs or equation environments, the caret immediately raises the next character or group. $x^2$ produces x with a superscript 2. $E=mc^2$ renders the famous equation with the 2 raised. If your superscript is longer than one character, wrap it in braces: $x^{n+1}$ raises the entire expression n+1 as a unit.

Nested superscripts work but produce smaller text at each level. $2^{2^{2}}$ creates a tower of exponents, with each level typeset smaller than the one below. This is correct mathematically but can become hard to read if nesting goes too deep.

Subscript in math mode

The underscore works the same way as the caret but lowers text instead. $x_1$ produces x with subscript 1. $H_2O$ creates the chemical formula for water with the 2 lowered. Again, multiple characters need braces: $a_{n+1}$ lowers the entire subscript n+1 as one unit.

Subscripts are especially common in sequences, matrices, and chemical notation. $x_i$, $a_{ij}$, and $C_6H_{12}O_6$ are all standard uses. The underscore character itself cannot appear in math mode without special handling, so if you need a literal underscore in text, use \_ or switch to text mode.

Combining superscript and subscript

You can attach both a superscript and a subscript to the same base symbol. $x_i^2$ and $x^2_i$ produce identical output: x with subscript i and superscript 2. The order does not matter in LaTeX. Both are rendered with the subscript on the lower left and the superscript on the upper right of the base character.

This is useful for tensor notation, where indices appear in multiple positions. $T^{ij}_{kl}$ creates a tensor with superscript indices ij and subscript indices kl, all attached to the letter T.

Superscript and subscript in text mode

Outside math mode, the caret and underscore do not work as superscript and subscript commands. Instead, use \textsuperscript{} and \textsubscript{}. For example, The 1\textsuperscript{st} place winner produces "The 1st place winner" with the st raised. H\textsubscript{2}O produces the chemical formula with the 2 lowered in text.

These commands are less flexible than math mode versions. They do not scale as smoothly with font size changes, and they cannot contain math symbols or complex expressions. For anything beyond a simple character or two, switch to math mode with dollar signs instead.

Common mistakes and how to fix them

Forgetting braces on multi-character superscripts or subscripts is the most frequent error. $x^10$ renders as x¹⁰ (only the 1 raised), not x¹⁰ (both digits raised). The fix is always $x^{10}$. Similarly, $H2O$ leaves the 2 in normal position; $H_2O$ lowers it correctly.

Another common issue is using ^ or _ in text mode without entering math mode first. The formula x^2 is important produces an error because LaTeX interprets the ^ as a special character outside math mode. The fix is to wrap the formula in dollar signs: The formula $x^2$ is important. If you need superscript or subscript in plain text, use \textsuperscript{} or \textsubscript{} instead.

Spaces inside braces are ignored, so $x^{ 2 }$ and $x^{2}$ produce identical output. However, spaces outside braces matter: $x^ 2$ treats the space as a separator and may produce unexpected results. Always put the caret or underscore immediately before the character or opening brace.

Frequently Asked Questions

Can I use superscript and subscript outside of math mode?

Yes, but not with ^ and _. Use \textsuperscript{} and \textsubscript{} in text mode. These commands work for simple text and numbers but do not support math symbols or complex expressions. For anything mathematical, wrap it in dollar signs to enter math mode instead.

What happens if I forget braces on a multi-character superscript?

Only the first character becomes superscript. $x^10$ raises only the 1, leaving the 0 in normal position. Always use braces for more than one character: $x^{10}$. This applies to subscripts too: $H_2O$ should be $H_{2}O$.

Can I nest superscripts or subscripts?

Yes. $2^{2^2}$ creates a tower of exponents, with each level typeset smaller. Nesting works for subscripts too: $x_{i_{j}}$ produces a subscript within a subscript. Readability suffers with deep nesting, so use it sparingly.

Does the order matter when I use both superscript and subscript?

$x_i^2$ and $x^2_i$ produce identical output. The order does not matter in LaTeX. Both place the subscript on the lower left and the superscript on the upper right of the base character.