Square Root in LaTeX
Write a square root with \sqrt{…}: \sqrt{x^2 + 1}. For a cube or nth root put the index in square brackets: \sqrt[3]{x}, \sqrt[n]{x}. The radical sign grows to fit whatever is inside the braces.
Root commands
\sqrt{x}Square root.
\sqrt[3]{x}Cube root.
\sqrt[n]{x}nth root.
\sqrt{\frac{a}{b}}Root of a fraction; the sign stretches.
\sqrt{x^2 + y^2}Root over a longer expression.
x^{1/2}Exponent form, when a radical would be too tall.
\sqrt[\leftroot{-2}\uproot{2} n]{x}Moves the index (amsmath
\leftroot,\uproot).\surdThe √ sign alone, without a bar.
Try it live
Change the formula and the preview redraws as you type. Copy the LaTeX, download a PNG or SVG, copy it for Word, or use Edit here on any example below to load it.
Square root examples
Each result below is drawn from the LaTeX under it. Copy the code, edit it on this page, or open it in the full editor.
Quadratic formula
LaTeXx = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}Distance formula
LaTeXd = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}Cube root
LaTeX\sqrt[3]{27} = 3Nested radicals
LaTeX\sqrt{2 + \sqrt{2 + \sqrt{2}}}Root of a fraction
LaTeX\sqrt{\frac{1 - \cos \theta}{2}}Even root heights
LaTeX\sqrt{a} + \sqrt{b} \quad \text{vs} \quad \sqrt{\vphantom{b} a} + \sqrt{b}\vphantom{b}adds the height of a b without printing it, so both radicals line up.Standard deviation
LaTeX\sigma = \sqrt{\frac{1}{N} \sum_{i=1}^{N} (x_i - \mu)^2}
How to write a root step by step
Use \sqrt in math mode and put everything under the radical in braces. Without braces only the next character goes under it: \sqrt x+1 means √x + 1.
For other roots add the index in square brackets before the braces: \sqrt[3]{x}. The index is set small in the notch of the radical.
Roots over letters of different heights come out uneven (√a is shorter than √b). Add a \vphantom or \mathstrut inside the lower one to match them.
Radical or exponent?
A radical over a tall fraction or a long sum becomes large and heavy. In those cases, and inside running text, (…)^{1/2} is easier to read and keeps the line height normal.
\[ \left( \frac{\sum_{i} x_i^2}{n} \right)^{1/2} \]Common mistakes
Parentheses do not group in LaTeX. Only the “(” goes under the radical.
Instead of\sqrt(x+1)Write\sqrt{x+1}The index goes in square brackets.
\sqrt{3}{x}is √3 followed by x.Instead of\sqrt{3}{x} (meant as a cube root)Write\sqrt[3]{x}A superscript on
\sqrtis not an index; it raises a stray 3 after the radical sign.Instead of\sqrt^3{x}Write\sqrt[3]{x}
In Overleaf, MathJax and Word
Overleaf and pdfLaTeX
\sqrtand\sqrt[n]work in any document.\leftrootand\uprootfor adjusting the index need\usepackage{amsmath}.MathJax and KaTeX
MathJax and KaTeX support
\sqrt,\sqrt[n]and\vphantom, so the same code works in Markdown, Jupyter and on web pages.Microsoft Word
Word has radical templates, but pasted LaTeX is not converted reliably. Write the root here and use Copy for Word to paste an editable Word equation.
Square root in LaTeX: questions
- What is the LaTeX command for square root?
\sqrt{…}in math mode, for example$\sqrt{2}$.- How do I write a cube root in LaTeX?
- Give the index in square brackets:
\sqrt[3]{x}. The same works for any root, such as\sqrt[4]{x}or\sqrt[n]{x}. - How do I write the square root of 2?
\sqrt{2}. For a single digit\sqrt2also works, but braces are clearer and needed for anything longer.- How do I get just the √ symbol?
\surdprints the radical sign without the bar. Outside math mode you can also type the Unicode character √ with XeLaTeX or LuaLaTeX.
Related LaTeX reference
- How to Write a Fraction in LaTeX\frac{numerator}{denominator}, \dfrac and \tfrac for size, continued fractions with \cfrac, slanted fractions and the a/b form.
- How to Write a Subscript in LaTeX_ for subscripts and ^ for superscripts, braces for more than one character, text indices, both at once and scripts in text mode.
- Plus Minus Sign in LaTeXThe ± sign with \pm, the minus-plus ∓ with \mp, ± in running text, and uncertainties such as 5.0 ± 0.1.
- LaTeX equation editorSymbol panel, live preview, and PNG, SVG, MathML or Word export.
- All LaTeX reference pagesSymbols, math structures and text formatting in one list.
Have the formula as a picture?
Paste a screenshot or photo of the equation and get its LaTeX, ready to copy or open in the editor.
Convert an image to LaTeX