LaTeX & math in Markdown
The syntax that works, where it renders, why it sometimes breaks — and how to export your equations to Word, PDF, and HTML.
Plain Markdown has no built-in math — but nearly every modern renderer adds it as an extension with the same two delimiters:
- Inline: wrap math in single dollar signs —
$E = mc^2$— on the same line as text. - Block: wrap math in double dollar signs —
$$E = mc^2$$— for a centered, full-size equation. - Inside the delimiters you write standard LaTeX, rendered by KaTeX or MathJax depending on the platform.
Whether it renders depends on where you publish — see the support table below.
Try it — type Markdown math
Edit the Markdown and watch it render with KaTeX, live. This is the same engine the export uses.
Inline math sits in single dollars: and .
Block (display) math uses double dollars:
The quadratic formula:
Edit the left panel — the preview updates live. ChatGPT’s \( \) and \[ \] work too.
Inline math: $ ... $
Single dollar signs around an expression render it inline with surrounding text — same line, same baseline. Use sparingly: complex fractions look cramped at body-text size.
$E = mc^2$Mass–energy equivalence$\alpha + \beta = \gamma$Greek letters$P(A \mid B) = \dfrac{P(B \mid A) P(A)}{P(B)}$Bayes — display fraction inline$x_i^2 + y_i^2 = r^2$Subscripts and superscripts
Display math: $$ ... $$
Double dollar signs put the equation on its own centered line at full display size. Use for anything bigger than a single fraction or summation.
- Definite integral
$$\int_{-\infty}^{\infty} e^{-x^2}\, dx = \sqrt{\pi}$$ - Sum
$$\sum_{n=1}^{N} n = \frac{N(N+1)}{2}$$ - Matrix
$$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$$ - Schrödinger equation
$$i\hbar\,\frac{\partial}{\partial t}\Psi = \hat{H}\,\Psi$$
Markdown math cookbook
Copy the LaTeX on the left, wrap it in $…$ or $$…$$, done. Each recipe shows exactly what renders.
Subscripts, superscripts & powers
^ raises, _ lowers. Anything longer than one character must be braced — the #1 cause of broken math.
x^2Power of 2x^{10}Multi-digit power — brace itx_iSubscriptx_{max}x_max only subscripts the mx_i^2Both at oncee^{-x^2}Expression in the exponent
Fractions & roots
\frac shrinks inside inline math; \dfrac forces full display size.
\frac{a}{b}Basic fraction\dfrac{1}{1+x}Display-size, even inline\frac{\partial f}{\partial x}Partial derivative\sqrt{x}Square root\sqrt[3]{x}nth root\binom{n}{k}Binomial coefficient
Greek letters
Lowercase spelled out; capitalize the command for uppercase (\delta → δ, \Delta → Δ).
\alpha, \beta, \gamma, \delta\alpha \beta \gamma \delta\epsilon, \theta, \lambda, \mu\epsilon \theta \lambda \mu\pi, \rho, \sigma, \tau\pi \rho \sigma \tau\phi, \chi, \psi, \omega\phi \chi \psi \omega\Gamma, \Delta, \Sigma, \Omega\Gamma \Delta \Sigma \Omega\varepsilon, \varphiVariant forms
Sums, integrals & limits
Bounds attach with the same _ and ^ used for sub/superscripts.
\sum_{n=1}^{N} nSum with bounds\prod_{i=1}^{n} a_iProduct\int_0^1 x^2 \, dxDefinite integral\oint_C \vec{F} \cdot d\vec{r}Contour integral\lim_{x \to \infty} \frac{1}{x}Limit\inftyInfinity
Vectors & calculus operators
Nabla (\nabla) covers gradient, divergence, and curl; \partial for partial derivatives.
\nabla fGradient (nabla)\nabla \cdot \vec{F}Divergence\nabla \times \vec{F}Curl\vec{v}, \hat{n}, \mathbf{A}Vector, unit vector, bold matrix\frac{dy}{dx}, \dot{x}, \ddot{x}Derivativesa \cdot b, \ a \times bDot and cross products
Matrices, cases & aligned equations
Environments use \begin…\end inside $$…$$. Rows split on \\, columns on &.
\begin{pmatrix} a & b \\ c & d \end{pmatrix}bmatrix → square brackets, vmatrix → determinant bars\begin{cases} … \end{cases} for piecewise functions\begin{aligned} aligns equation systems on &
Relations
- \leq
- \geq
- \approx
- \neq
- \equiv
- \sim
- \propto
- \in
- \notin
Arrows
- \to
- \rightarrow
- \Rightarrow
- \leftrightarrow
- \mapsto
- \implies
Brackets
- \left( ... \right)
- \lvert x \rvert
- \lVert v \rVert
- \langle a, b \rangle
Where Markdown math renders
Math is never part of core Markdown — it’s a renderer extension, so the same$…$ works in some places and not others.
| Platform | Math? | Notes |
|---|---|---|
| GitHub | Yes | Issues, PRs, README, gists (MathJax). Also ```math blocks. |
| GitLab | Yes | $…$ inline and ```math fenced blocks (KaTeX). |
| Obsidian | Yes | $…$ and $$…$$ (MathJax). |
| Jupyter | Yes | Markdown cells render $…$ / $$…$$ (MathJax). |
| VS Code preview | Yes | Built-in Markdown preview (KaTeX). |
| Pandoc | Yes | tex_math_dollars → HTML, DOCX (OMML), PDF. |
| Notion | Partial | Inline/block equation blocks, not standard $ Markdown. |
| Reddit / Slack / Discord | No | No native math — paste a rendered image instead. |
Exporting equations to documents
Paste Markdown into LLM to Doc and your equations carry through to real documents:
HTML
Rendered with KaTeX — equations are styled, selectable spans, and the LaTeX source is preserved in MathML so it stays copy-pasteable.
DOCX (Word)
Translated to native Office Math (OMML) via Pandoc. Word treats each equation as a real, editable object — compatible with Word, Google Docs, and LibreOffice.
Rendered via KaTeX and rasterized faithfully, so fractions, integrals, and matrices land print-ready on the page.
Why your math isn’t rendering
- ChatGPT’s delimiters. ChatGPT often emits
\( ... \)and\[ ... \]instead of dollar signs. LLM to Doc rewrites these automatically; elsewhere, search-and-replace them with$/$$. - Math inside backticks. Wrapping a formula in inline code (
`$x$`) renders it as literal text, not math. Use the math delimiters directly. - Unbraced subscripts. Underscore is the subscript operator, so
$x_max$only subscripts the m. Brace it:$x_{max}$. - Cramped inline fractions. Use
\dfracinstead of\fracfor a full-size fraction inside inline math.
Frequently asked questions
Does Markdown support LaTeX or math?
Plain Markdown (CommonMark) has no math syntax. Almost every modern renderer adds it as an extension using $…$ for inline math and $$…$$ for display math, powered by KaTeX or MathJax. So whether math renders depends entirely on where you publish it.
How do I write a math formula in Markdown?
Wrap inline math in single dollar signs — $E = mc^2$ — and display (block) math in double dollar signs on their own lines — $$ … $$. Inside the delimiters you write standard LaTeX: \frac{a}{b}, x^2, \sqrt{x}, \sum, \int, Greek letters like \alpha, and so on.
What's the difference between $ and $$?
$…$ renders inline at the surrounding text size and baseline. $$…$$ renders as a centered display block at full size — use it for anything larger than a simple fraction or summation.
Why isn't my Markdown math rendering?
Usual causes: the platform doesn't support math (e.g. Reddit, Slack); the formula is inside backticks so it's treated as code; a multi-character subscript wasn't braced (x_max only subscripts the m — use x_{max}); or it came from ChatGPT using \( \) / \[ \] delimiters instead of $ / $$.
Can I convert Markdown math to Word or PDF?
Yes. LLM to Doc converts $…$ and $$…$$ to native, editable Word equations (OMML) in DOCX, and renders them faithfully in PDF and HTML — paste your Markdown, preview it, and export.
How do I write subscripts and superscripts in Markdown math?
Use _ for subscripts and ^ for superscripts inside the math delimiters: $x_i$, $x^2$. Anything longer than one character must be wrapped in braces — $x_{max}$ and $x^{10}$, not $x_max$ or $x^10$, which only apply to the first character.
How do I write a fraction in Markdown?
Inside math delimiters, use \frac{numerator}{denominator} — for example $\frac{a}{b}$. Inline fractions render small; use \dfrac{a}{b} to force full display size, or put the formula in a $$…$$ block.
How do I write math in GitHub Markdown?
GitHub renders $…$ inline math and $$…$$ display math in READMEs, issues, PRs, and gists. For expressions with characters that clash with Markdown (like | in tables), use a fenced code block with the math language: ```math on its own lines around the LaTeX.
See your formulas render & export
Paste Markdown, watch the live preview, and export to Word, PDF, or HTML. The homepage has a one-click Formulas example pre-loaded with the equations on this page.
Open the converter