Boxed Formula in LaTeX (\boxed{x})

x\boxed{x}
LaTeX command
\boxed{x}
Package
Add to your preamble:\usepackage{amsmath}
Mode
Text and math mode

Where it is used

Draws a rectangular frame around a math expression, often to highlight a final result.

Students box final answers and authors highlight key identities with \boxed{E = mc^2}. The command works inside math mode, keeping the content in display or text style as appropriate, unlike \fbox, which switches to text mode and needs $...$ inside it. In align environments, put \boxed around one side or a whole line's content but not across the & alignment point. The padding and rule thickness follow \fboxsep and \fboxrule, so you can adjust them locally. For colored frames, \fcolorbox wrapped around inline math is the usual next step.

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

x=−b±b2−4ac2a\boxed{x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}}
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Boxed Formula: $\boxed{x}$

\[ \boxed{x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}} \]
\end{document}

Related symbols

All Accents at Modifiers →

Frequently asked questions

How do I write Boxed Formula in LaTeX?
Type \boxed{x} in math mode, for example $\boxed{x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}}$. Load amsmath first with \usepackage{amsmath}.
Which package do I need for \boxed{x}?
\boxed{x} needs amsmath: add \usepackage{amsmath} to your preamble before the document starts.
Can I use \boxed{x} in text mode, or only in math mode?
Both. \boxed{x} compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
Math poweredSumulat ng LaTeX gamit ang AI

Pinakamahusay na AI LaTeX Editor, Alternatibo sa Overleaf

Tinutulungan ng Octree ang mga researcher mula sa 15+ na unibersidad na sumulat ng research papers nang mas mabilis gamit ang AI

  • Gumawa ng magagandang TikZ diagrams gamit ang AI
  • Mag-upload ng larawan at i-convert ito sa LaTeX nang walang problema
  • Makakuha ng instant na tulong sa pagsulat at pag-format ng research papers