How to Write Superscript and Subscript in LaTeX 📐

If you work with scientific, mathematical, or technical writing, you've likely needed to write superscript or subscript text—whether it's an exponent like x², a chemical formula like H₂O, or a mathematical index. LaTeX is a powerful document preparation system that handles these formatting needs with simple, consistent commands, and understanding how to use them properly will make your technical documents look professional and remain clean and maintainable.

This guide explains how superscript and subscript work in LaTeX, when to use each, and the practical differences between approaches so you can choose what fits your document type and workflow.

What Are Superscript and Subscript? 🔤

Superscript is text or numbers positioned above the baseline and typically smaller than regular text. Common uses include exponents (10³), ordinal indicators (1st, 2nd), footnote markers, and mathematical notation.

Subscript is text or numbers positioned below the baseline and also typically smaller. You'll see subscript in chemical formulas (H₂SO₄), variable indexing (x₁, x₂), and mathematical sequences.

Both are essential for clarity and correctness in technical writing. In plain text or basic word processors, achieving this appearance often requires manual formatting or special characters. LaTeX automates this process with built-in commands that work consistently across your entire document.

The Basic LaTeX Commands for Superscript and Subscript

LaTeX offers two fundamental commands that handle the vast majority of use cases:

Superscript: The Caret Operator (^)

To create superscript in LaTeX, use the caret symbol (^) followed by the character or group you want to raise:

This renders as: E = mc²

For multiple characters or anything more complex, wrap the superscript content in curly braces:

Without braces, only the immediate next character becomes superscript. So x^10 renders as x¹⁰ (only the "1" is superscript), while x^{10} correctly renders both digits as superscript.

Subscript: The Underscore Operator (_)

To create subscript in LaTeX, use the underscore (_) followed by the character or group:

This renders as: H₂O

Like superscript, use curly braces for multiple characters:

Again, without braces, only the next single character becomes subscript.

Context Matters: Math Mode vs. Text Mode

LaTeX has two primary modes: math mode and text mode. Where and how you use superscript and subscript depends on which mode you're working in.

In Math Mode (Most Common)

Math mode is the standard environment for mathematical expressions. You enter math mode using dollar signs ($...$ for inline math) or \[...\] (for displayed math):

In math mode, the caret and underscore operators work exactly as described above. LaTeX automatically handles the sizing and positioning. This is the preferred approach for any mathematical notation, equations, or scientific formulas.

In Text Mode

If you need superscript or subscript in regular text (not within an equation), you'll need to explicitly enter math mode:

You can also use the \textsuperscript{} and \textsubscript{} commands, which work directly in text mode without switching to math mode:

This approach is useful when you want to maintain text formatting (font, size, spacing) while adding superscript or subscript elements.

Combining Superscript and Subscript

Sometimes you need both superscript and subscript on the same element—for example, in matrix notation or complex mathematical expressions:

This produces x with a subscript i and a superscript 2. The order doesn't matter; x^2_i produces the same result.

For more complex arrangements where you need precise control:

This is less common in basic use but available when positioning matters.

Key Differences Between Approaches

AspectCaret/Underscore (^ and _)\textsuperscript{} / \textsubscript{}\textit{} with formatting
Works inMath mode (primary)Text mode directlyEither (with setup)
Automatic sizingYes, optimized for equationsLess aggressive sizingManual only
ConsistencyPerfect across documentGood for mixed text/mathVaries with font
Readability in sourceVery clearClearDepends on setup
Common useScientific equations, formulasFootnotes, ordinals, mixed documentsSpecialized formatting

Practical Examples Across Common Scenarios

Chemical formulas (text context):

Mathematical expressions:

Complex indexing:

Ordinal numbers in text:

Common Pitfalls and How to Avoid Them

Forgetting braces for multi-character content: Using x^10 instead of x^{10} is the single most common mistake. Your document will compile, but only the first digit becomes superscript. Always use braces unless you're certain it's a single character.

Mixing math mode and text mode: If you're working with superscript or subscript in regular text, ensure you're either in math mode ($...$) or using the \text... commands. Otherwise, LaTeX will throw an error.

Inconsistent formatting: Within a single document, stick to one approach. If your document mixes text and equations, decide whether to handle text-based superscript using \text... commands or by switching to math mode. Consistency improves readability and maintainability.

Spacing issues: Superscript and subscript in math mode don't add extra space around them. If you write x^2y, it may appear cramped. Use spacing commands like \, (thin space) if needed: x^2\,y.

When to Choose Each Approach

Your decision depends on your document's context:

  • Academic or scientific papers with heavy equations: Use math mode with ^ and _ throughout. This is the standard and gives you maximum control and consistency.

  • Mixed technical and prose documents: Use \textsuperscript{} and \textsubscript{} for text-based superscript/subscript (ordinals, footnotes), and math mode for actual equations.

  • Maximizing consistency with surrounding fonts: If your document emphasizes a specific typeface or visual style, \textsuperscript{} and \textsubscript{} allow better font matching than math mode.

Understanding Your Document Workflow

Before deciding which commands to use, evaluate these factors:

  • Document type: Is this a research paper, technical manual, or general document?
  • Proportion of math vs. text: How much of your content involves equations or formulas?
  • Audience expectations: Do readers expect a specific formatting standard (many academic fields do)?
  • Long-term maintenance: Will others edit or extend this document?

These considerations don't change which commands you'll use, but they influence how systematically you apply them and what conventions you establish for your entire document.

LaTeX's superscript and subscript tools are straightforward once you understand the context-dependent rules. The caret and underscore operators in math mode handle the vast majority of needs efficiently, while text-mode commands provide flexibility when mixing formatted text with mathematical notation. The key is using braces consistently and choosing the right mode for your content.