LaTeX is the standard way to write mathematical equations, but raw LaTeX code is hard to read until it is rendered. An online viewer turns your code into properly formatted maths instantly. This guide shows you the essential syntax and how to preview effectively.
Inline versus display maths
Inline maths sits inside a sentence, wrapped in single dollar signs, like $E = mc^2$. Display maths sits on its own line, centered and larger, wrapped in double dollar signs, like $$\int_0^\infty e^{-x^2}dx$$. Use inline for mentions and display for equations the reader should study.
The essential LaTeX commands
- Fractions: \frac{numerator}{denominator}.
- Powers: x^2, with braces for multi-character exponents: x^{10}.
- Subscripts: x_n, with braces for multi-character indices: x_{max}.
- Square roots: \sqrt{x}, or \sqrt[n]{x} for nth roots.
- Sums and integrals: \sum_{i=1}^{n} x_i and \int_{a}^{b} f(x) dx.
- Greek letters: \alpha, \beta, \gamma, \pi, and capitals like \Gamma.
- Matrices: the pmatrix environment with & between columns and double backslash between rows.
Step-by-step: preview an equation
- Write or paste your LaTeX code into a viewer.
- Watch the rendered output update as you type. If part of the equation does not render, the error is usually near that spot.
- Check braces: every opening brace needs a closing one, and a missing brace swallows the rest of the equation.
- Check dollar signs: an unclosed dollar merges two formulas into one garbled block.
- For long derivations, use display mode so lines do not wrap awkwardly.
- Export the rendered equation as an image when you need it in a document or slide.
Common errors
Missing braces and unclosed dollar signs cause most failures. Another is using a command from a package the viewer does not load; in that case the command shows as plain text or an error. Special characters like % and & need escaping in LaTeX, since they have their own meanings. When a preview shows raw code instead of maths, one of these is almost always the cause.
Try it the faster way
Preview your LaTeX equations instantly with the tool below.
Prefer the full page? Open the online LaTeX viewer directly.
Quick tips
- Use inline mode for mentions and display mode for study.
- Count braces and dollar signs when rendering fails.
- Export as an image for documents and slides.
LaTeX preview is a fast feedback loop: type, see, fix. Learn the core commands, watch the braces, and the equations take care of themselves.
Frequently asked questions
What is the difference between KaTeX and MathJax? Both render LaTeX in browsers. KaTeX is faster and covers most common maths, while MathJax supports a wider range of commands and environments but renders more slowly. For typical equations, either works, and most viewers pick one for you.
Why does my equation show raw code instead of maths? Usually a missing brace, an unclosed dollar sign, or a command the renderer does not support. Check braces first, then dollars, then whether the command needs a package the viewer does not load.
Can I use LaTeX for a whole document online? Viewers render equations, not full documents with titles and sections. For complete documents, use an online LaTeX editor with document support, or write the document in markdown with LaTeX equations embedded.
Worked example
Render the quadratic formula: x equals negative b plus or minus the square root of b squared minus 4ac, all over 2a. In LaTeX that is x = \frac{-b \pm \sqrt{b^2 – 4ac}}{2a}. If the preview shows raw code, check the braces around the fraction’s numerator and denominator first, since a missing brace swallows the rest. If the square root covers too much or too little, check its own braces. Once the preview matches the formula you expect, export it as an image for your document.
