Markdown Math

Markdown Math extends standard Markdown by adding support for mathematical expressions written with LaTeX syntax. It allows you to display everything from simple inline formulas to complex multi-line equations while keeping your documents clean, portable, and easy to edit.

Instead of inserting equations as images, you can write formulas directly in Markdown. When rendered by compatible platforms such as KaTeX or MathJax, the expressions remain sharp, searchable, and easy to update as your documents evolve.

Markdown Math is widely used for:

  • Writing scientific and engineering documentation
  • Research papers and academic notes
  • Mathematics and physics assignments
  • Data science and machine learning documentation
  • Technical blogs and developer documentation
  • Knowledge bases and personal notes in apps like Obsidian

In this guide, you'll learn how Markdown Math works, when to use inline and block equations, write common mathematical expressions with LaTeX syntax, understand platform compatibility, and follow best practices for creating readable mathematical documentation.

🟢 Practice as you read: Open the Markdown Editor — it supports KaTeX math in live preview.

Open EditorDownload PDF

What Is Markdown Math?

Markdown Math is a method of writing mathematical equations inside Markdown documents using LaTeX syntax. Instead of inserting screenshots or manually formatting formulas, you write plain text that compatible Markdown applications automatically render as mathematical notation.

For example, instead of writing:

x squared plus y squared equals z squared

you can write:

$x^2 + y^2 = z^2$

When viewed in a Markdown application that supports math rendering, the expression is displayed as a properly formatted equation.

Markdown itself does not include native support for mathematical notation. Applications such as Obsidian, Jupyter Notebook, many documentation frameworks, and other Markdown tools rely on rendering engines like KaTeX or MathJax to convert LaTeX syntax into readable mathematical expressions.

This approach keeps Markdown files lightweight, version-friendly, and easy to edit while supporting everything from simple algebra to advanced scientific notation. If you're new to Markdown, start with Markdown Basics and Markdown Syntax — Markdown Math builds on the same foundation as standard elements like Markdown Tables and code blocks.

Why Use Markdown Math?

Writing equations as plain text quickly becomes difficult to read, especially as formulas become longer or more complex.

Markdown Math lets you write mathematical expressions that remain editable in plain text while rendering as professional-quality equations in supported Markdown applications.

It's commonly used for:

  • Research papers and academic publications
  • Engineering and technical documentation
  • Mathematics and physics notes
  • Machine learning and data science notebooks
  • Software documentation containing formulas or algorithms
  • Educational tutorials and online learning resources

Because equations are stored as plain text, they're easy to edit, search, review in version control, and reuse across projects without relying on images or external equation editors.

How Markdown Math Works

Markdown Math uses standard LaTeX syntax enclosed within special delimiters. When a Markdown renderer detects these delimiters, it passes the content to a math rendering engine such as KaTeX or MathJax, which generates the formatted equation.

There are two primary ways to write mathematical expressions:

  • Inline Math for short equations that appear within a sentence.
  • Block Math for larger equations that should be displayed on their own line.

Understanding these two formats is enough to write most mathematical documentation, from simple variables and fractions to complex scientific formulas.

Inline Math

Inline Math is used when a mathematical expression appears within a normal sentence. Wrap the equation in a single dollar sign ($) on both sides.

Syntax

The area of a circle is $A=\pi r^2$.

Output

The area of a circle is A = πr².

Inline Math works well for variables, symbols, short formulas, units, and equations that don't need their own line. It keeps mathematical expressions readable without interrupting the flow of the surrounding text.

Block Math

Block Math is designed for larger equations that should stand on their own line. Wrap the expression in double dollar signs ($$).

Syntax

$$
E = mc^2
$$

Output

A centered, standalone mathematical equation.

Use block equations for derivations, multi-step calculations, matrices, systems of equations, and formulas that need extra space for readability.

Inline Math vs Block Math

Inline Math Block Math
Appears within a sentence Appears on its own line
Uses single dollar signs ($...$) Uses double dollar signs ($$...$$)
Best for short expressions and variables Best for long equations and derivations
Keeps text flowing naturally Improves readability for complex formulas

Choose inline math for quick references inside paragraphs, and block math whenever the equation is an important part of the explanation.

First Markdown Math Examples

Here are a few common expressions you'll use when writing Markdown Math.

Simple Equation#

$a+b=c$

Fraction#

$\frac{a}{b}$

Square Root#

$\sqrt{x}$

Exponent#

$x^2$

Summation#

$\sum_{i=1}^{n} i$

Once you're comfortable with these basic patterns, you can combine them to create more advanced mathematical expressions using standard LaTeX syntax.

Where Is Markdown Math Used?

Markdown Math is supported by many modern Markdown editors, documentation platforms, and note-taking applications that integrate a LaTeX rendering engine such as KaTeX or MathJax.

You'll commonly find Markdown Math in:

  • Academic papers and lecture notes
  • Engineering and scientific documentation
  • Data science and machine learning notebooks
  • Software documentation with mathematical formulas
  • Personal knowledge bases and technical notes
  • Educational content and online courses

Because equations remain plain text until they're rendered, they are easy to edit, version-control, and reuse across different projects.

Essential Markdown Math Equations

Most mathematical expressions are built from a small set of reusable LaTeX commands. Once you understand these core patterns, you can write everything from simple algebra to complex scientific equations.

The examples below cover the syntax you'll use most often, including fractions, exponents, subscripts, square roots, summations, matrices, Greek letters, and mathematical operators. Copy the syntax directly into any Markdown application that supports KaTeX or MathJax rendering.

Writing Fractions#

Fractions are one of the most common mathematical expressions.

Use the \frac command.

Syntax

$\frac{a}{b}$

Example

$\frac{3}{4}$

This represents three divided by four.

Another example:

$$
\frac{x+1}{y-2}
$$

Block Math makes larger fractions easier to read.

Common Uses

  • Probability
  • Algebra
  • Statistics
  • Scientific calculations

Writing Square Roots#

Use the \sqrt command to display square roots.

Syntax

$\sqrt{x}$

Example

$\sqrt{25}=5$

You can also create more complex square roots.

$$
\sqrt{x^2+y^2}
$$

Square roots are frequently used in geometry, engineering, and physics.

Writing Powers#

Superscripts are created with the caret (^).

Example

$x^2$

Produces:

Another example:

$5^3=125$

You can also group expressions.

$(x+y)^2$

This is useful when the exponent applies to more than one value.

Writing Subscripts#

Subscripts use the underscore (_).

Example:

$x_1$

Another example:

$H_2O$

Subscripts are commonly used in:

  • Chemistry
  • Physics
  • Mathematics
  • Programming variables

Combining Superscripts and Subscripts#

You can combine both together.

Example:

$x_1^2$

This displays the variable with both a subscript and a superscript.

It's commonly used when working with mathematical sequences and indexed variables.

Greek Letters#

Many scientific formulas use Greek letters instead of the English alphabet.

Here are some of the most common ones.

Symbol Markdown Math
α $\alpha$
β $\beta$
γ $\gamma$
θ $\theta$
λ $\lambda$
π $\pi$
σ $\sigma$
Ω $\Omega$

Example:

$\alpha+\beta=\gamma$

Greek letters appear frequently in mathematics, statistics, engineering, and machine learning.

Mathematical Operators#

Markdown Math supports many mathematical symbols.

Operation Syntax
Addition $a+b$
Subtraction $a-b$
Multiplication $a \times b$
Division $\frac{a}{b}$
Less Than $a<b$
Greater Than $a>b$
Less Than or Equal $a\le b$
Greater Than or Equal $a\ge b$
Not Equal $a\ne b$

Example:

$a \times b = c$

Using proper mathematical operators makes formulas much easier to understand than plain text.

Writing Summations#

Summations are commonly used in statistics and mathematics.

Use the \sum command.

Example:

$$
\sum_{i=1}^{n} i
$$

This means:

Add every value from 1 to n.

Summations are frequently used in:

  • Statistics
  • Algorithms
  • Machine learning
  • Data science

Writing Integrals#

Integrals are widely used in calculus.

Example:

$$
\int x^2 dx
$$

Another example:

$$
\int_0^1 x\,dx
$$

Block Math is recommended for integrals because they are easier to read on their own line.

Writing Limits#

Limits describe what happens as a value approaches another value.

Example:

$$
\lim_{x\to0}\frac{\sin x}{x}
$$

Limits are commonly used in:

  • Calculus
  • Engineering
  • Physics

Using Brackets#

Large mathematical expressions often require scalable brackets.

Example:

$$
\left(\frac{a+b}{c+d}\right)
$$

The \left and \right commands automatically adjust the bracket size to match the equation.

This improves readability, especially for nested expressions.

Writing Matrices#

Matrices are common in linear algebra, computer graphics, and machine learning.

Example:

$$
\begin{bmatrix}
1 & 2 \\
3 & 4
\end{bmatrix}
$$

This creates a 2 × 2 matrix.

Using Block Math keeps matrices properly aligned and much easier to read.

A Complete Example#

Here's a simple mathematical note that combines several concepts you've learned.

# Algebra Notes

The quadratic formula is:

$$
x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
$$

The variable $x$ represents the unknown value.

The discriminant is $b^2-4ac$.

When $\Delta>0$, there are two real solutions.

This example demonstrates how Inline Math and Block Math work together in a real Markdown document. See Markdown Code Blocks for fenced blocks and syntax highlighting.

Markdown Math Platform Compatibility

Markdown Math is not part of the original Markdown specification. Mathematical expressions are displayed only in applications that include a rendering engine such as KaTeX or MathJax.

Before using Markdown Math, verify that your editor, documentation platform, or publishing tool supports one of these rendering engines. Otherwise, equations may appear as plain LaTeX code instead of formatted mathematical expressions.

The following platforms provide varying levels of Markdown Math support.

Markdown Math in GitHub

GitHub does not support every LaTeX feature everywhere, but many Markdown surfaces now render mathematical expressions using KaTeX.

For supported locations, use the same inline and block syntax.

Inline Math

$E = mc^2$

Block Math

$$
\int_0^1 x^2 dx
$$

If you're writing technical documentation for GitHub repositories, always preview your README or documentation after publishing to confirm equations render correctly. See GitHub Flavored Markdown for GFM syntax and GitHub-specific formatting.

Markdown Math in Obsidian

Obsidian includes excellent Markdown Math support, making it a popular choice for students, researchers, and engineers.

Both inline and block equations render automatically inside notes.

$\sqrt{x+1}$

$$
\frac{a+b}{c}
$$

Combined with backlinks, internal links, and Graph View, Obsidian is well suited for building mathematical notes, research journals, and interconnected knowledge bases. See Obsidian Markdown for vaults, internal links, and note organization.

Markdown Math in Visual Studio Code

Visual Studio Code supports Markdown Math through compatible Markdown preview extensions.

Once enabled, you can write equations directly inside Markdown files and preview them without leaving the editor.

This makes VS Code a practical choice for technical documentation, developer notes, and project documentation that includes mathematical notation. See VS Code Markdown for preview, shortcuts, and extensions.

Markdown Math in Jupyter Notebook

Jupyter Notebook provides built-in support for Markdown cells with mathematical expressions, making it one of the most widely used environments for scientific computing and data science.

You can combine explanatory text, mathematical notation, executable code, and visualizations in the same notebook, making complex technical documents easier to understand and reproduce.

KaTeX vs MathJax

KaTeX and MathJax are the two most widely used rendering engines for displaying mathematical expressions in Markdown. Both use standard LaTeX syntax, so the Markdown you write is usually the same. The main differences are rendering speed, feature support, and platform compatibility.

Feature KaTeX MathJax
Rendering Speed Faster Slightly slower
Browser Performance Excellent Very good
LaTeX Support Most common expressions Broader LaTeX feature support
Best For Documentation, websites, notes Academic publishing, advanced mathematics

For most Markdown documentation, KaTeX is the preferred choice because it renders quickly and supports the mathematical expressions that most users need. If your documents rely on advanced LaTeX commands, MathJax may provide better compatibility.

Best Practices

Following a few simple practices makes mathematical documentation easier to read, maintain, and review.

  • Use inline math for short variables and expressions that appear naturally within a sentence.
  • Reserve block math for larger equations, derivations, and multi-line formulas.
  • Preview your document before publishing to confirm every equation renders correctly.
  • Keep notation consistent throughout the document. Avoid switching between different variable names for the same concept.
  • Add short explanations before or after complex equations so readers understand their purpose.
  • Use descriptive headings to separate related mathematical topics.
  • Test compatibility if your Markdown will be viewed on multiple platforms, since rendering engines may support different LaTeX features.

Good documentation combines clear explanations with readable mathematical notation instead of relying on equations alone.

Common Mistakes

Markdown Math is straightforward once you understand the syntax, but these mistakes are common.

  • Forgetting to close $ or $$ delimiters.
  • Mixing inline and block math incorrectly.
  • Using LaTeX commands that aren't supported by the current renderer.
  • Forgetting to preview the document before publishing.
  • Copying equations from unsupported editors without testing the output.
  • Writing long equations inline when they should be displayed as block equations.

Checking your rendered output is the easiest way to catch formatting issues before sharing your document.

Real-World Examples

Markdown Math is useful in many different situations.

Education#

Teachers and students can create lecture notes, assignments, and study guides with clearly formatted equations.

Research#

Researchers often use Markdown to draft papers, organize findings, and document experiments that include mathematical notation.

Technical Documentation#

Developers can explain algorithms, formulas, and engineering concepts without switching to another document format.

Data Science#

Machine learning and statistics documentation often includes probability formulas, matrices, and summations.

Markdown Math makes these documents much easier to read.

Practice Markdown Math

The best way to learn is by writing equations yourself.

  1. Open the Markdown Editor and create a new document.
  2. Write a short note with one inline equation ($E = mc^2$) and one block equation using $$.
  3. Add a fraction ($\frac{3}{4}$), a square root ($\sqrt{25}$), and a subscript ($H_2O$).
  4. Preview your work in the editor to confirm KaTeX renders each expression correctly.
  5. Compare your syntax with the examples in this guide and adjust any missing dollar signs or braces.

Review your work against this checklist:

  • Inline math uses single $ delimiters
  • Block math uses $$ on separate lines
  • Fractions use \frac{numerator}{denominator}
  • Exponents use ^ and subscripts use _
  • Every equation renders in live preview

Keep the Markdown Cheat Sheet open for quick syntax lookup.

Summary

Markdown Math makes it easy to write professional mathematical documentation using familiar Markdown and standard LaTeX syntax. Whether you're documenting research, creating technical guides, writing engineering notes, or preparing educational content, mathematical expressions remain editable, portable, and version-friendly.

By understanding inline math, block equations, common LaTeX commands, and platform compatibility, you can create documents that are both accurate and easy to maintain.

To continue learning, explore our related guides on Markdown Syntax, Markdown Code Blocks, Markdown Tables, Obsidian Markdown, VS Code Markdown, and GitHub Flavored Markdown. Together, these guides cover the essential building blocks for writing high-quality technical documentation in Markdown.

Frequently Asked Questions

  1. 1

    What is Markdown Math?

    Markdown Math is a way to write mathematical equations in Markdown using LaTeX syntax. It allows you to display formulas, fractions, matrices, square roots, and many other mathematical expressions in a clear and professional format.

  2. 2

    Does standard Markdown support math?

    No. Standard Markdown does not include built-in support for mathematical equations. Math works only when the Markdown editor or platform includes a rendering library such as KaTeX or MathJax.

  3. 3

    What is the difference between Inline Math and Block Math?

    Inline Math is used inside a sentence, for example: The formula is $E = mc^2$. Block Math displays the equation on its own line using double dollar signs. Use Inline Math for short expressions and Block Math for larger equations.

  4. 4

    Can I use LaTeX in Markdown?

    Yes. Most Markdown applications that support mathematical equations use LaTeX syntax. You don't need to learn the entire LaTeX language. Learning the most common commands is enough for everyday documentation.

  5. 5

    Does GitHub support Markdown Math?

    GitHub supports Markdown Math in many modern Markdown experiences, but support is not available everywhere. If your equations don't render correctly, check whether the specific GitHub feature or page supports mathematical notation.

  6. 6

    Does Obsidian support Markdown Math?

    Yes. Obsidian provides excellent support for Markdown Math, making it a popular choice for students, researchers, engineers, and technical writers. You can create both inline and block equations inside your notes.

  7. 7

    Can I write mathematical formulas in Visual Studio Code?

    Yes. Visual Studio Code can display Markdown Math through its preview feature and compatible extensions. This makes it a useful editor for writing technical documentation and educational content.

  8. 8

    Which is better: KaTeX or MathJax?

    Both are excellent options. KaTeX is faster and lightweight. MathJax supports a wider range of advanced LaTeX features. For most Markdown documentation, KaTeX provides everything you'll need.

  9. 9

    Why isn't my Markdown equation rendering?

    This usually happens because the platform doesn't support Markdown Math, dollar sign delimiters are missing, the LaTeX syntax contains an error, or the Markdown preview doesn't have math rendering enabled. Always preview your document before publishing.

  10. 10

    Where is Markdown Math commonly used?

    Markdown Math is widely used in research papers, engineering documentation, scientific reports, machine learning tutorials, data science notebooks, university notes, technical documentation, and educational websites. It helps present mathematical content in a clean, readable format.