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

In LaTeX, you raise text above the baseline with the caret symbol ^ and lower text below the baseline with the underscore symbol _. Both symbols work inside math mode, which you enter with dollar signs ($...$) for inline math or with \[ and \] for displayed equations. Outside math mode, these symbols do not produce superscript or subscript — they produce errors or unexpected output.

The character or group when ready following ^ or _ becomes the superscript or subscript. If you want more than one character in the superscript or subscript, you must wrap it in curly braces { }. Without braces, only the first character moves up or down.

LaTeX automatically adjusts the size of superscript and subscript text to be smaller than the surrounding text, and it handles spacing so the result looks professional. You do not need to manually resize or position anything.

Key Takeaways

  • Use ^ for superscript and _ for subscript, but only inside math mode (between $ signs or in equation environments).
  • Wrap multiple characters in curly braces: $x^{2}$ and $H_{2}O$ may support the entire group moves up or down together.
  • Single characters do not need braces: $x^2$ and $x_1$ work correctly, but $x^ab$ raises only the a, leaving b at normal height.
  • You can stack superscript and subscript on the same base: $x^{2}_{i}$ produces x with both a superscript 2 and a subscript i.

Single characters: when braces are optional

When your superscript or subscript is a single character or digit, you can omit the braces. The code $x^2$ produces x with a superscript 2. The code $a_1$ produces a with a subscript 1. LaTeX reads the single character after ^ or _ and applies the formatting to it alone.

This shorthand works because LaTeX stops reading the superscript or subscript as soon as it encounters a character that is not part of the group. A single digit or letter is unambiguous, so braces are unnecessary. However, many writers use braces anyway for consistency and to avoid mistakes when editing later.

Multiple characters: braces are required

When your superscript or subscript contains more than one character, you must enclose it in curly braces. The code $x^{10}$ produces x with a superscript 10. Without braces, $x^10$ produces x with a superscript 1, followed by a 0 at normal height — because LaTeX reads only the 1 as the superscript.

The same rule applies to subscripts. The code $H_{2}O$ produces H with a subscript 2, followed by O. The braces tell LaTeX that both the 2 and the O are separate: the 2 is the subscript, and the O is the next character in the formula. If you wrote $H_2O$ without braces around the 2, LaTeX would still interpret it correctly because 2 is a single character, but the braces make your intent clearer.

Braces also allow you to include spaces, punctuation, or special symbols in a superscript or subscript. The code $x^{\text{max}}$ produces x with a superscript reading "max" in regular (non-math) font. The \text command requires braces to work, so braces become necessary for readability.

Combining superscript and subscript on the same base

You can attach both a superscript and a subscript to the same character or group. Write the base, then the superscript, then the subscript: $x^{2}_{i}$ produces x with a superscript 2 and a subscript i. The order does not matter — $x_{i}^{2}$ produces the same result.

LaTeX positions the superscript above and to the right of the base, and the subscript below and to the right. If the base is a single character, the positioning is automatic and looks correct. If the base is a group (in braces), LaTeX treats the entire group as the base and positions both the superscript and subscript relative to it.

Superscript and subscript in different math environments

The caret and underscore work the same way in all math environments: inline math ($...$), displayed equations (\[...\]), the equation environment, the align environment, and others. The only requirement is that you are inside math mode.

In displayed equations, superscript and subscript text is often larger than in inline math, because displayed equations have more space. LaTeX handles this automatically — you do not need to adjust your code. The code $x^{2}$ in a paragraph looks different from the same code in a displayed equation, but the LaTeX syntax is identical.

Common mistakes and how to fix them

The most common error is forgetting to enter math mode. If you write x^2 outside of dollar signs, LaTeX treats ^ as a special character and produces an error. The fix is to wrap the expression in dollar signs: $x^2$.

The second common error is forgetting braces for multiple characters. The code $x^10$ raises only the 1, leaving the 0 behind. The fix is to write $x^{10}$. If you see a superscript or subscript that looks cut off or misaligned, check whether you need braces.

A third error is using ^ or _ outside math mode to mean something else. In regular text, the underscore is often used for spacing or naming, and the caret has no standard meaning. LaTeX interprets these as math mode commands and produces errors. If you need a literal underscore or caret in text, use \_ and \textasciicircum respectively.

Frequently Asked Questions

Do I need braces around a single digit in a superscript?

No. The code $x^2$ works correctly without braces. LaTeX reads the single digit 2 as the superscript and stops. However, using braces ($x^{2}$) is also correct and makes your code easier to edit later, so many writers use them for consistency.

What if I want a superscript of a superscript?

You can nest braces: $x^{2^{3}}$ produces x with a superscript of 2, and 2 has its own superscript of 3. LaTeX automatically scales each level smaller than the one before it. This works for subscripts too: $x_{1_{2}}$ produces x with a subscript of 1, and 1 has its own subscript of 2.

Can I use superscript and subscript outside of math mode?

Not with ^ and _. Those symbols only work inside math mode. If you need superscript or subscript in regular text, use the \textsuperscript{} and \textsubscript{} commands. For example, \textsuperscript{st} produces "st" as superscript text outside of math mode.

Why does my superscript look too small or too far away?

LaTeX sizes and positions superscript and subscript automatically based on the font and the surrounding context. If the result looks wrong, check that you are using the correct base character and that your braces are in the right place. If you are mixing text and math, make sure the math is inside dollar signs.

Can I have a superscript and subscript on different parts of an expression?

Yes. The code $x^{2} + y_{1}$ produces x with a superscript 2, plus y with a subscript 1. Each base character or group can have its own superscript and subscript independently. You can also write $x^{2}y_{1}$ to put them next to each other without the plus sign.