LaTeX error · Commands, braces and arguments
Extra }, or forgotten $.
Quick answer
TeX met a } that does not close anything in the current mode. Either there is one closing brace too many, or a group was opened outside math and closed inside it (or the other way round), for example \textbf{$x}$. Remove the extra } or move it so each {...} pair lies completely inside or completely outside the $...$.
The error in the log
This is how the message appears in the .log file (and in the compile output). The line starting with l. is the line number where TeX noticed the problem; the real mistake is there or just before it.
! Extra }, or forgotten $.
<recently read> \egroup
l.5 The value \textbf{$x = 3}
$ is important.Why it happens
- An extra closing brace, often left behind after deleting a command such as
\textbf{. - Braces and dollars interleaved:
\textbf{$x}$or${x$}. - A literal brace meant as text, written
}instead of\}.
How to fix it
Make the brace and the math mode nest properly: either put the whole formula inside the argument (\textbf{$x = 3$}) or keep the command inside math ($\mathbf{x} = 3$). If the brace is simply extra, delete it.
Broken: reproduces the error
\documentclass{article}
\begin{document}
The value \textbf{$x = 3}$ is important.
\end{document}Try this in Octree — free LaTeX editor with AI, compiles in your browser
Fixed: compiles cleanly
\documentclass{article}
\begin{document}
The value \textbf{$x = 3$} is important.
\end{document}Related errors
- Missing } inserted – A brace group was still open when math mode or a table cell ended.
- Too many }'s – A closing brace at the outer level of the document that closes nothing.
- Missing $ inserted – A math-only symbol (
_,^,\alpha) was used in text, or math mode was left early. - All LaTeX errors and warnings – The full list, grouped by cause
Frequently Asked Questions
What is the difference between Extra } and Too many }'s?
Extra }, or forgotten $ is raised inside a paragraph or math when a } closes nothing in the current mode. Too many }'s is the same mistake at the outer level of the document, between paragraphs.
How do I print a curly brace?
Write \{ and \} in text and math. In math, \left\{ gives a large brace, as in a cases definition.
The line in the log looks fine. Where is the extra brace?
TeX reports the brace where it noticed the imbalance. Check the lines just before it, and any macro you defined with \newcommand that is used on that line.
Paste your document into Octree — compile errors get a Fix with AI button
When a compile fails, Octree shows the error next to the line that caused it and offers a one-click fix that you can review before applying. Free, nothing to install.
Fix it in Octree →