Web & code

How to Write Equations in Markdown

Understand inline and block math delimiters and renderer differences across Markdown tools.

Updated 2026-07-27 · Reviewed 2026-07-26 by Chevee Math Tools

Markdown does not define universal math syntax

CommonMark defines headings, lists, links, code, and other core constructs, but mathematical delimiters are usually an extension added by the publishing platform. A file that renders equations on one site may show raw dollar signs on another.

Identify the renderer before choosing syntax. Check its documentation for inline math, display math, supported commands, and escaping behavior.

Write inline mathematics

A common extension uses single dollar delimiters:

The area is $A=\pi r^2$ square units.

Inline math belongs inside a sentence and should be short enough not to disrupt line flow. Avoid placing currency amounts next to ambiguous dollar delimiters without checking the renderer’s parsing rules.

Write display mathematics

Many renderers accept double dollar signs or bracket delimiters:

$$
\int_0^1 x^2\,dx=\frac{1}{3}
$$

Another common form is:

\[
\int_0^1 x^2\,dx=\frac{1}{3}
\]

Use the form documented by the destination. Do not assume both are enabled.

Check command compatibility

A Markdown renderer may use KaTeX, MathJax, or another engine. Basic commands usually transfer, while package-specific macros may fail. Test matrices, aligned equations, custom operators, and uncommon symbols against the renderer’s supported-command list.

When an error occurs, reduce the source to a minimal equation and restore one command at a time.

Avoid Markdown conflicts

Underscores, asterisks, pipes, and backticks have Markdown meanings outside math mode. Keep equation delimiters balanced and use fenced code blocks when demonstrating source rather than rendering it. Inside tables, pipes in formulas may require escaping or an alternative layout.

Provide a fallback

For environments with no math extension, use readable Unicode for simple expressions, link to a rendered page, or provide an accessible SVG with an equivalent text description. Do not rely on a screenshot as the only representation.

Troubleshoot raw output

If the source appears unchanged, confirm that math rendering is enabled and that the file type or page context supports it. If only one equation fails, check braces and unsupported commands. If a static-site build succeeds locally but fails in production, compare plugin versions and configuration.

Verify the published output

Open the deployed page rather than relying only on the editor preview. Verify the visual equation, copyable source, mobile overflow, dark mode, and accessible reading. The final output is correct only when the production renderer preserves the intended mathematical structure.

Put this guide into practice

Continue with a browser tool

Use the related reference or tool while the notation and workflow are still fresh.

How this guide was checked

Review method: Intent alignment review, notation/source verification, worked-example check, cross-format rendering review, and duplicate-content comparison for How to Write Equations in Markdown

Verified against: Official standards, primary documentation, and the page-specific sources listed below

What changed: Removed repeated sitewide boilerplate and added content-type-specific decision, verification, and applicability guidance for this exact task.

Page purpose: equations in markdown — Understand and apply the topic in mathematical or scientific writing

Automated quality check: Passed critical indexing checks.

Verification references

These primary standards and official documentation pages were used to check character identity, syntax, or platform behavior described above.

Reuse, attribution, and correction

Share this reference without losing its source

Copy a citation, permanent link, Markdown link, or self-contained embed card. Each reusable format points readers back to the maintained canonical page.

Report an issue

Search the whole reference

Symbols, formulas, guides, tools and commands

Start typing to search.

move · Enter open · Esc close