End of Proof Symbol in LaTeX: QED Box, Square and More
November 11, 2026 · 10 min read
End of Proof Symbol in LaTeX: QED, Empty Box and Filled Box
The end of proof symbol in LaTeX comes from the amsthm package. Wrap your argument in \begin{proof}...\end{proof} and LaTeX prints an empty box flush right on the last line. You can move it with \qedhere, swap it for a filled box or the word QED, or remove it. Each option below comes with code you can paste.
How Do You Print the End of Proof Symbol in LaTeX?
Load amsthm in the preamble and use its proof environment. The environment starts with an italic "Proof." heading and appends \qedsymbol at the end. In the package source, \qedsymbol defaults to \openbox, a hollow square that amsthm draws itself from four rules, so you don't need a symbol font for it.
\usepackage{amsthm}
\begin{proof}
Since $(a-b)^2 \ge 0$, expanding gives $a^2 - 2ab + b^2 \ge 0$.
\end{proof}
That prints "Proof. Since (a − b)² ≥ 0, ..." with a small open square at the right margin of the final line.
The mark has a few names: tombstone, halmos, or QED box. QED abbreviates the Latin quod erat demonstrandum, "which was to be demonstrated". Paul Halmos is credited with bringing the square into mathematics in 1950, borrowing it from the end marks that close magazine articles.
A Minimal amsthm Proof Environment You Can Compile
Here's a complete file that compiles with pdflatex. We tested it on TeX Live 2025. It loads amsmath for display math and amssymb for the filled box used later on this page. Keep amsthm after amsmath, as the amsthm guide requires.
\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
For all real $a$ and $b$, $a^2 + b^2 \ge 2ab$.
\end{theorem}
\begin{proof}[Proof of Theorem 1]
Since $(a-b)^2 \ge 0$, expanding gives $a^2 - 2ab + b^2 \ge 0$.
\end{proof}
\end{document}
The optional argument replaces the heading, so this proof opens with "Proof of Theorem 1." and amsthm adds the period for you. To rename every proof heading at once, put \renewcommand{\proofname}{Beweis} in the preamble. If you load babel, it resets \proofname at \begin{document} and that preamble change is lost. Use \addto\captionsenglish{\renewcommand{\proofname}{Argument}} instead, swapping in your document's language. With babel and ngerman, the heading already reads Beweis.
One trap from the amsthm user guide: a blank line just before \end{proof} breaks the placement. The box can then land alone on the next line, or even at the top of a new page.
How Do You Put the QED Box After a Displayed Equation?
If a proof ends with a displayed equation, the box drops to an empty line below it. The fix is \qedhere, placed exactly where the symbol should go. With amsmath loaded, it sits flush right on the same line as the equation.
\begin{proof}
Rearranging the expansion,
\[
a^2 + b^2 \ge 2ab. \qedhere
\]
\end{proof}
The same command works on the last line of align* and inside equation*. It doesn't work with eqnarray or with old-style $$...$$ displays, because only the amsmath environments and \[...\] are built for it.
Numbered equations are the awkward case, since the number and the box compete for the right margin. The amsthm guide calls \qedhere inappropriate for displays numbered on the right. The TeX FAQ entry on proofs shows \tag*{\qedhere}, which puts the box in the tag slot.
\begin{equation*}
a^2 + b^2 \ge 2ab \tag*{\qedhere}
\end{equation*}
In a numbered equation, that tag replaces the number, so the line loses its (1). If the number matters, close the proof with a short sentence after the display instead.
Lists work the same way. When a proof ends with enumerate or itemize, put \qedhere as the last thing before \end{enumerate}. If \qedhere throws an error inside an equation, the guide's fallback is \mbox{\qedhere}.
Changing \qedsymbol to a Filled Box or the Word QED
You change the end of proof symbol in LaTeX by redefining \qedsymbol. Put the redefinition in the preamble to affect every proof:
\usepackage{amssymb}
\renewcommand{\qedsymbol}{$\blacksquare$}
Now every proof ends with a solid square, ■. For the classic letters instead, use \renewcommand{\qedsymbol}{\textit{QED}}.
To change a single proof, put the same line inside it. The proof environment is a group, so the change ends with \end{proof}.
We prefer the default open box. It's lighter on the page and needs no extra package. A filled square looks heavy at the end of every short lemma.
LaTeX Empty Box Commands: \square, \Box and \openbox Compared
An empty box in LaTeX usually means one of three commands. They look alike but come from different places, and only two of them render outside a real LaTeX compiler.
| Command | Glyph | Package | Mode | KaTeX |
|---|---|---|---|---|
\openbox | □ (drawn with rules) | amsthm | text | No |
\square | amssymb (or amsfonts) | math | Yes | |
\Box | amssymb, amsfonts or latexsym | math | Yes | |
\blacksquare | amssymb | math | Yes | |
| Unicode ∎ | ∎ | none, U+220E END OF PROOF | text | Plain text |
Plain LaTeX defines none of the three math boxes, so $\square$ fails until you load amssymb or amsfonts. With amsfonts alone, \Box is the same glyph as \square. Load latexsym as well and \Box comes from that package's font instead, so it looks slightly different. The Comprehensive LaTeX Symbol List shows every variant side by side. For everyday math commands, our LaTeX symbols reference lists the package each one needs.
The LaTeX empty box from \square is a font glyph, while \openbox is built from rules with fixed proportions. That's why \hfill$\square$ never quite matches the box amsthm prints. Drawing a frame around text is a different job entirely, handled by \fbox.
Adding a QED Mark Without the Proof Environment
Sometimes a long proof lives in its own \section instead of a proof environment. Type \qed at the end of the final paragraph and amsthm adds the current \qedsymbol flush right, with the usual spacing. The guide notes it only works properly after ordinary text.
The plain alternative is \hfill$\square$. It works in simple cases, but it has a weakness we reproduced. When the last line is full, the line breaks before \hfill and the square lands at the left margin of a new line. With \qed, a full last line still pushes the box down, but it stays at the right margin.
Definitions, examples and remarks can get their own mark too. Wrap a theorem-like environment this way:
\theoremstyle{definition}
\newtheorem{exampleinner}{Example}
\newenvironment{example}
{\pushQED{\qed}\renewcommand{\qedsymbol}{$\triangle$}\exampleinner}
{\popQED\endexampleinner}
Each example now closes with a small triangle, so readers can tell where an example stops and the main text resumes.
Removing or Suppressing the End of Proof Symbol
To drop the symbol from one proof, add \renewcommand{\qedsymbol}{} just before \end{proof}. To remove it from every proof, put that line in the preamble instead. Both come straight from the amsthm user guide.
Watch for nested proofs. Each proof environment appends its own box, so a lemma proved inside a larger proof gives you two boxes when both end together. Blank out the inner one, or end the outer proof with a sentence after the lemma.
Proof Ending Cheat Sheet: Which Command for Which Job
Every command above in one table. Copy the middle column and check the last one against your preamble.
| You want | Write | Needs |
|---|---|---|
| Box at the end of a proof | \begin{proof}...\end{proof} | amsthm |
| Box on the last line of a display | \qedhere | amsthm, amsmath |
| Box in a display's tag slot | \tag*{\qedhere} | amsthm, amsmath |
| Box after ordinary text | \qed | amsthm |
| Filled box in every proof | \renewcommand{\qedsymbol}{$\blacksquare$} | amsthm, amssymb |
| The word QED | \renewcommand{\qedsymbol}{\textit{QED}} | amsthm |
| No box in one proof | \renewcommand{\qedsymbol}{} before \end{proof} | amsthm |
| Box in Markdown math | $\square$ or $\blacksquare$ | KaTeX |
Ending Proofs in Markdown and KaTeX
Markdown apps that render math with KaTeX handle the box glyphs but not amsthm. In KaTeX 0.16, \square, \Box and \blacksquare render inline and in display math. \qed, \qedhere, \openbox and \begin{proof} are undefined, so they show as errors. The KaTeX supported functions list is the reference.
Our editor's preview uses KaTeX, which doesn't render \qed or the proof environment. End the paragraph with an inline box instead:
**Proof.** Since $(a-b)^2 \ge 0$, expanding gives $a^2 + b^2 \ge 2ab$. $\square$
That renders as a bold "Proof." label, the argument, and an open square right after the last sentence. For a display line, add space before a filled box with $$a^2 + b^2 \ge 2ab \qquad \blacksquare$$. If you'd rather avoid math entirely, type ∎ (U+220E) directly.
Here's a short demo you can edit:
The limitation is placement. Markdown has no proof environment, so nothing pushes the box to the right margin and it sits right after the last word. For the Markdown math syntax itself, see our guide to writing equations in Markdown. If your document is mostly theorems and proofs, Markdown vs LaTeX explains when to switch to real LaTeX. To render a single box as an image, try the LaTeX equation editor, which uses KaTeX 0.16.
The end of proof symbol in LaTeX takes one package and almost no code. Load amsthm, close each argument with the proof environment, and reach for \qedhere when a proof ends in a display or a list. Redefine \qedsymbol only if your style guide asks for a filled box. In Markdown, end with $\square$ and try it in the editor, where the KaTeX preview shows the box as you type.