Subscript uses an underscore, superscript uses a caret
In LaTeX, you write subscript by placing an underscore _ before the character or group of characters you want to lower. You write superscript by placing a caret ^ before them. Both work the same way: the symbol tells LaTeX what comes next should be raised or lowered relative to the baseline text.
If you want only one character as subscript or superscript, you can type it directly after the symbol. If you want multiple characters, wrap them in curly braces { } so LaTeX treats them as a single unit. Without the braces, only the first character gets the formatting.
These commands work inside math mode (between dollar signs) and in some contexts outside it, though math mode is where you will use them most often. The difference between getting it right and getting it wrong is usually visible when ready in your preview.
Key Takeaways
- Type an underscore before a character to make it subscript: H_2O produces H₂O.
- Type a caret before a character to make it superscript: x^2 produces x².
- Use curly braces around multiple characters so they all get the same formatting: x^{2n} instead of x^2n.
- Subscript and superscript work in math mode (between dollar signs) and in some text contexts, but math mode is the standard place to use them.
- You can nest subscripts and superscripts: x^{2_i} creates a superscript with a subscript inside it.
Single characters versus multiple characters
When you write H_2O in math mode, LaTeX reads the underscore and makes only the 2 subscript. The O stays at normal height because you did not tell LaTeX to format it. This works fine for chemical formulas and straightforward cases.
When you need more than one character as subscript or superscript, the braces become necessary. If you type x^10, LaTeX makes only the 1 superscript and leaves the 0 at normal height. Type x^{10} instead, and both digits rise together. The braces group them so LaTeX treats 10 as a single unit to format.
This rule applies to letters too. If you want a_{max}, you need the braces: a_{max}. Without them, a_max makes only the m subscript.
Using subscript and superscript in math mode
Math mode is where subscript and superscript appear most often. You enter math mode by typing a dollar sign $, writing your equation, and closing with another dollar sign. Inside those dollar signs, the underscore and caret work as subscript and superscript commands.
A straightforward example: $E = mc^2$ produces the famous equation with the 2 as superscript. Another: $\sum_{i=1}^{n} x_i$ creates a summation symbol with i=1 as subscript and n as superscript, which is the standard mathematical notation.
Outside of math mode, in regular text, the underscore and caret do not work the same way. LaTeX treats them as literal characters or commands for other purposes. If you need subscript or superscript in text (not equations), you can use the \textsubscript{} and \textsuperscript{} commands, though this is less common in technical writing.
Nesting subscripts and superscripts
You can put a subscript inside a superscript or a superscript inside a subscript. The syntax is the same: use braces to group what you want, and nest the underscore or caret inside.
For example, $x^{2_i}$ creates x with a superscript containing 2 with a subscript i underneath it. Or $a_{b^2}$ creates a with a subscript containing b with a superscript 2. The nesting can go as deep as you need, though readability usually suffers after two or three levels.
When you nest, the inner formatting is smaller than the outer formatting. LaTeX automatically scales subscripts and superscripts down, and scales them down again if they contain their own subscripts or superscripts. This keeps the notation readable even when it gets complex.
Common mistakes and how to fix them
The most common mistake is forgetting braces around multiple characters. If you type $x^10$ expecting both digits to be superscript, only the 1 will be. Add braces: $x^{10}$.
Another mistake is using subscript or superscript outside math mode without the \textsubscript{} or \textsuperscript{} commands. If you type H_2O in regular text (not between dollar signs), LaTeX will either ignore the underscore or treat it as a literal character, depending on your document setup. Wrap it in math mode: $H_2O$.
A third mistake is forgetting that spaces inside braces are ignored. If you type $x^{2 n}$, the space disappears and you get x with a superscript 2n with no space between them. If you need a space, use a thin space command like \, inside the braces: $x^{2\,n}$.
Subscript and superscript with special symbols
Subscript and superscript work with any character or symbol, not just numbers and letters. You can write $\alpha_1$ to get the Greek letter alpha with a subscript 1. You can write $\int_0^{\infty}$ to get an integral sign with 0 as subscript and infinity as superscript.
When you use special symbols or commands (anything starting with a backslash), they still need braces if you want multiple items in the subscript or superscript. For example, $x^{\alpha + \beta}$ puts the entire expression α + β as superscript. Without the braces, only the \alpha would be superscript.
Some symbols, like the integral and summation, have built-in subscript and superscript behavior. When you use \int or \sum, the subscript and superscript appear in the right places automatically — below and above the symbol in display mode, or to the side in inline mode. This is handled by LaTeX itself, not by you.
Frequently Asked Questions
Can I use subscript and superscript in the title or section headings?
Yes, but wrap them in math mode. If you write \section{$H_2O$ in Chemistry}, the subscript works correctly. Without the dollar signs, LaTeX will not recognize the underscore as a subscript command and may produce an error or unexpected output.
What is the difference between ^ and \textsuperscript?
The caret ^ works in math mode and is the standard way to write superscript in equations. The \textsuperscript{} command works in regular text outside math mode. Use ^ for equations and \textsuperscript{} for text like footnote markers or ordinal numbers in prose.
Why does my subscript look too small or too far down?
LaTeX automatically sizes and positions subscripts and superscripts based on the surrounding text and the nesting level. If it looks wrong, check that you have the right braces around the content. If the sizing still bothers you, you can adjust it with commands like \scriptstyle, but this is rarely necessary and usually makes the document harder to maintain.
Can I have both subscript and superscript on the same character?
Yes. Type $x_i^2$ or $x^2_i$ — the order does not matter. LaTeX will place the subscript below and the superscript above (or to the side in inline mode). Both $x_i^2$ and $x^2_i$ produce the same output.
Do I need to load a special package to use subscript and superscript?
No. Subscript and superscript are built into LaTeX. The underscore and caret work in any document without loading additional packages. If you want advanced formatting or special symbols, you might load packages like amsmath, but basic subscript and superscript require nothing extra.