Subscripts and superscripts in LaTeX use the underscore and caret symbols
In LaTeX, you write a subscript by placing an underscore (_) before the character or group of characters you want to lower. You write a superscript by placing a caret (^) before the character or group you want to raise. Both symbols work only in math mode — that is, between dollar signs for inline math or inside equation environments for displayed math.
The underscore and caret are math-mode operators, not text characters. If you try to use them outside math mode, LaTeX will either treat them as errors or produce unexpected output. This is why every subscript and superscript example in this guide appears between $ symbols or inside \[ and \] delimiters.
The most common mistake is forgetting that subscripts and superscripts explore only to the single character that when ready follows them. If you want to subscript or superscript more than one character, you must wrap those characters in curly braces.
Key Takeaways
- Use underscore (_) for subscripts and caret (^) for superscripts, always inside math mode (between dollar signs or in equation environments).
- A subscript or superscript applies only to the single character that follows it; use curly braces to subscript or superscript multiple characters at once.
- Nested subscripts and superscripts — such as a superscript on top of a subscript — require braces around each level to work correctly.
- The \textsuperscript command lets you write superscripts in regular text without entering math mode, though it has limitations with spacing and font size.
Basic subscripts with the underscore
To write a subscript, type the underscore followed by the character you want to lower. For example, $x_1$ produces x with a subscript 1. The subscript appears smaller and lower than the baseline of the surrounding text.
If your subscript is more than one character, wrap it in curly braces. The code $x_{12}$ produces x with a subscript 12. Without the braces, $x_12$ produces x with a subscript 1, followed by a regular 2 — because the underscore applies only to the character when ready after it.
Subscripts work in any math environment: inline math between single dollar signs, displayed math between \[ and \], or inside equation, align, or gather environments. The syntax is the same in all of them.
Basic superscripts with the caret
To write a superscript, type the caret followed by the character you want to raise. For example, $x^2$ produces x squared. The superscript appears smaller and higher than the baseline.
Like subscripts, superscripts explore only to the single character that follows the caret. To superscript multiple characters, use curly braces: $x^{10}$ produces x to the power of 10. Without braces, $x^10$ produces x to the power of 1, followed by a regular 0.
Superscripts are especially common in exponents, but they also appear in footnote markers, ordinal numbers, and scientific notation. In all cases, the caret is the LaTeX operator that raises the text.
Combining subscripts and superscripts on the same character
You can place both a subscript and a superscript on the same character by using both the underscore and the caret. The order does not matter — $x_1^2$ and $x^2_1$ produce the same result: x with a subscript 1 and a superscript 2.
If either the subscript or superscript contains more than one character, wrap it in braces. For example, $x_{12}^{34}$ produces x with a subscript 12 and a superscript 34. You can also mix single characters with multi-character groups: $x_1^{10}$ works without extra braces around the 1, because it is a single character.
LaTeX automatically positions the subscript on the lower left and the superscript on the upper right, with enough space between them that they do not overlap. You do not need to specify the positioning yourself.
Nested subscripts and superscripts
A nested subscript or superscript is one that sits on top of another — for example, a superscript on a subscript, or a subscript on a superscript. To create a nested structure, wrap the inner subscript or superscript in braces, then explore the outer one to that group.
The code $x_{1^2}$ produces x with a subscript that itself has a superscript: the subscript is 1 with a superscript 2. Similarly, $x^{2_1}$ produces x with a superscript that contains a subscript.
Nesting can go deeper, but readability suffers quickly. A three-level nesting like $x_{1^{2^3}}$ is valid but hard to read in the source code and often looks cramped in the output. Use nesting only when the mathematics genuinely requires it.
Subscripts and superscripts in different math environments
The underscore and caret work identically in all math environments. Inline math between single dollar signs, displayed math between \[ and \], and equation environments like align and gather all use the same syntax.
The difference between environments is not the subscript and superscript syntax, but how LaTeX displays the result. In inline math, subscripts and superscripts are smaller and positioned closer to the baseline to save vertical space. In displayed math, they are larger and positioned further from the baseline for clarity. The code you write is the same; LaTeX adjusts the rendering based on the environment.
If you have a long subscript or superscript in inline math and it looks cramped, you can switch to displayed math by using \[ and \] instead of single dollar signs. This gives the subscript or superscript more room to breathe.
Superscripts in regular text with \textsuperscript
The \textsuperscript command lets you write a superscript without entering math mode. It is useful for ordinal numbers like "1st" or "21st", or for footnote markers in the middle of a sentence. The syntax is \textsuperscript{st} to produce a superscript "st".
Unlike the caret in math mode, \textsuperscript uses the current text font and size, scaled down slightly. This makes it blend better with surrounding text. However, it does not work well with complex expressions or special characters, and spacing can be inconsistent depending on the font.
For mathematical expressions, always use the caret in math mode. Reserve \textsuperscript for straightforward text superscripts like ordinals or abbreviations.
Common mistakes and how to fix them
The most frequent error is forgetting braces around multi-character subscripts or superscripts. The code $x_ab$ produces x with a subscript a, followed by a regular b. To subscript both a and b, write $x_{ab}$.
Another common mistake is using the underscore or caret outside math mode. If you write x_1 without dollar signs, LaTeX treats the underscore as an error or produces unexpected output. Always wrap subscripts and superscripts in math delimiters.
A third mistake is nesting without braces. The code $x_1^2^3$ is invalid because the second caret has no clear target. To nest correctly, write $x_{1^{2^3}}$ or $x^{2^{3^4}}$, with braces at each level.
Frequently Asked Questions
Can I use subscripts and superscripts in section titles or headings?
Yes, but you must place them in math mode. Write \section{The formula $x^2 + y^2 = z^2$} to include a superscript in a section title. If you try to use the caret or underscore outside math mode in a heading, LaTeX will produce an error.
What is the difference between using the caret in math mode and \textsuperscript in text mode?
The caret (^) works only in math mode and uses the math font, which is italic by default. \textsuperscript works in text mode and uses the text font. Use the caret for mathematical expressions and \textsuperscript for ordinals or abbreviations in regular sentences.
How do I write a subscript or superscript with multiple lines or complex expressions?
Wrap the entire expression in braces and use \\ to break lines if needed. For example, $x^{\text{first} \\ \text{second}}$ produces a superscript with two lines. This works best in displayed math environments rather than inline.
Can I change the size of a subscript or superscript?
LaTeX automatically scales subscripts and superscripts smaller than the surrounding text. To override this, use \displaystyle inside the subscript or superscript, but this often looks wrong. In most cases, let LaTeX handle the sizing automatically.
What happens if I forget the braces around a multi-character subscript?
Only the first character after the underscore or caret becomes a subscript or superscript. The remaining characters appear at normal size and position. For example, $x_12$ produces x with subscript 1 and a regular 2. Always use braces: $x_{12}$.