Home/Docs/Markdown Math

Markdown Math

Markdown is a simple markup language that makes writing documents easy. While standard Markdown is great for headings, lists, links, tables, and code blocks, it doesn't include built-in support for mathematical equations.

That's where Markdown Math comes in.

Markdown Math allows you to write mathematical expressions using LaTeX syntax. It makes it possible to display equations, formulas, fractions, square roots, matrices, and many other mathematical symbols in a clean and professional format.

Markdown Math is widely used by:

  • Students
  • Teachers
  • Researchers
  • Developers
  • Data scientists
  • Engineers
  • Technical writers

Whether you're writing research notes, technical documentation, educational content, or project documentation, Markdown Math helps present mathematical information clearly.

In this guide, you'll learn how Markdown Math works, how to write equations, where it's supported, and the best practices for creating readable mathematical documents.

If you're new to Markdown, we recommend reading the Markdown Basics and Markdown Syntax guides before learning Markdown Math.

🟢 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 way of writing mathematical equations inside Markdown documents.

Instead of typing plain text like this:

x squared plus y squared equals z squared

you can write the equation using LaTeX syntax.

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

When rendered by a supported Markdown application, it appears as a properly formatted mathematical equation.

Markdown itself does not understand mathematical notation. Instead, applications that support Markdown Math use rendering libraries such as KaTeX or MathJax to display equations.

This approach keeps your Markdown files simple while allowing you to include professional mathematical notation.

Why Use Markdown Math?

Writing equations as plain text can quickly become difficult to read.

For example:

(x+2)^2 = x^2 + 4x + 4

Although understandable, complex formulas become confusing when written only as text.

Markdown Math presents equations in a structured and readable format, making technical documents much easier to understand.

Some common uses include:

  • Mathematics notes
  • Science documentation
  • Physics equations
  • Engineering calculations
  • Programming documentation
  • Machine learning tutorials
  • Data science notebooks
  • Academic research papers

Even simple formulas become much clearer when properly formatted.

How Markdown Math Works

Markdown Math uses LaTeX syntax inside special delimiters.

There are two common ways to write equations:

  • Inline Math
  • Block Math

Inline Math is used inside a sentence.

Block Math is used for larger equations that should appear on their own line.

Learning these two formats is enough to start writing most mathematical expressions.

Inline Math

Inline Math is used when the equation is part of a sentence.

Place the equation between single dollar signs.

Example:

The formula is $E = mc^2$.

When rendered, the equation appears within the same line as the surrounding text.

Inline Math is useful for:

  • Variables
  • Short formulas
  • Units
  • Small calculations
  • Scientific notation

Example:

The area of a square is $a^2$.

Another example:

The speed of light is represented by $c$.

Using Inline Math keeps your writing clean without interrupting the flow of the paragraph.

Block Math

Some equations are too large to fit comfortably inside a sentence.

For these cases, use Block Math.

Wrap the equation with double dollar signs.

$$
E = mc^2
$$

The equation is displayed on its own line, making it much easier to read.

Block Math works well for:

  • Long equations
  • Algebra
  • Calculus
  • Physics formulas
  • Engineering calculations
  • Statistical formulas

Example:

$$
a^2 + b^2 = c^2
$$

Large equations are much easier to understand when displayed separately from the surrounding text.

Inline Math vs Block Math

Choosing the right format improves readability.

Feature Inline Math Block Math
Appears inside a sentence ✅ Yes ❌ No
Displays on a separate line ❌ No ✅ Yes
Best for short equations ✅ Yes ❌ No
Best for complex formulas ❌ No ✅ Yes

As a general rule:

  • Use Inline Math for short expressions.
  • Use Block Math for larger or more detailed equations.

Your First Markdown Math Examples

Let's start with a few simple examples.

Addition

$2 + 3 = 5$

This displays a basic addition equation.

Multiplication

$4 \times 5 = 20$

The \times command displays the multiplication symbol.

Division

$\frac{10}{2} = 5$

The \frac command creates a properly formatted fraction instead of using a slash.

Exponents

$x^2$

The caret (^) is used to create superscripts and powers.

Subscripts

$H_2O$

The underscore (_) creates subscripts.

This is commonly used in chemistry and mathematics.

Where Is Markdown Math Used?

Markdown Math is supported in many tools and documentation platforms.

You'll commonly see it used in:

  • Research papers
  • University notes
  • Engineering documentation
  • Machine learning tutorials
  • Jupyter Notebooks
  • Obsidian notes
  • Static documentation websites
  • Technical blogs
  • Scientific reports

As more documentation platforms add support for mathematical notation, Markdown Math has become an essential skill for technical writing.

Essential Markdown Math Equations

Now that you know how Inline Math and Block Math work, it's time to learn the mathematical expressions you'll use most often.

Instead of memorizing every LaTeX command, focus on understanding the purpose of each one. Once you know when to use a particular expression, writing equations becomes much easier.

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

One of the most common questions is whether Markdown Math works everywhere.

The short answer is no.

Markdown itself does not support mathematical equations. Math is displayed only when the application or website includes a math rendering library such as KaTeX or MathJax.

Before adding equations to your documents, it's a good idea to check whether your platform supports Markdown Math.

The table below shows how Markdown Math is supported on popular platforms.

Platform Markdown Math Support Notes
Obsidian ✅ Yes Built-in support using a math renderer.
Jupyter Notebook ✅ Yes Excellent support for inline and block equations.
VS Code ✅ Yes Available in Markdown preview and with supported extensions.
Hugo ✅ Yes Requires configuration depending on your theme.
MkDocs ✅ Yes Usually supported through plugins or themes.
Docusaurus ✅ Yes Can be enabled with remark and rehype plugins.
GitHub ⚠️ Partial Supported in some Markdown contexts, but not every page or feature.
Plain Text Editors ❌ No Equations appear as raw Markdown text.

Always preview your document before publishing to make sure your equations render correctly.

Markdown Math in GitHub

GitHub supports mathematical expressions in many modern Markdown experiences, but support is not available everywhere.

If your equation doesn't render as expected, check whether the specific GitHub page or feature supports math.

Inline example:

$E = mc^2$

Block example:

$$
a^2+b^2=c^2
$$

If you're writing documentation for GitHub, preview your content before publishing. See GitHub Markdown for GFM syntax, README examples, and GitHub-specific features.

Markdown Math in Obsidian

Obsidian is one of the best applications for writing mathematical notes.

It supports:

  • Inline equations
  • Block equations
  • Complex formulas
  • Scientific notation
  • Academic writing

This makes it popular among students, teachers, engineers, and researchers. See Obsidian Markdown for vaults, internal links, backlinks, graph view, and note organization.

Markdown Math in Visual Studio Code

Visual Studio Code supports Markdown Math through its preview system and compatible extensions.

This allows developers to write documentation containing equations while editing Markdown files.

It's especially useful when creating technical documentation or educational content. See VS Code Markdown for preview, shortcuts, extensions, and documentation workflow in Visual Studio Code.

Markdown Math in Jupyter Notebook

Jupyter Notebook has excellent support for Markdown Math.

Because notebooks combine text, code, and mathematical expressions, they're widely used in:

  • Data science
  • Machine learning
  • Statistics
  • Scientific computing
  • Research

Most mathematical tutorials you see online are created using Jupyter notebooks.

KaTeX vs MathJax

When writing Markdown Math, you'll often hear about KaTeX and MathJax.

Both are libraries that render LaTeX equations into beautifully formatted mathematics.

KaTeX

KaTeX focuses on speed.

Advantages include:

  • Very fast rendering
  • Lightweight
  • Great for documentation websites
  • Excellent performance

Many modern documentation sites choose KaTeX because pages load quickly.

MathJax

MathJax focuses on compatibility.

Advantages include:

  • Supports a larger set of LaTeX commands
  • Handles more advanced mathematical notation
  • Popular in academic environments

If your equations are highly complex, MathJax may support features that KaTeX does not.

Which One Should You Choose?

For most Markdown users:

  • Choose KaTeX if you want fast page loading and excellent performance.
  • Choose MathJax if you need advanced mathematical features or maximum LaTeX compatibility.

If you're only writing common equations such as fractions, powers, square roots, and matrices, either option works well.

Best Practices

Following a few simple practices will make your mathematical documents easier to read.

Use Inline Math for Small Expressions

Inline Math works best for variables and short formulas.

Example:

The radius is $r$.

Avoid using long equations inside a paragraph because they interrupt the flow of reading.

Use Block Math for Large Equations

Large formulas should always be placed on their own line.

Example:

$$
E = mc^2
$$

This improves readability and makes complex equations easier to understand.

Keep Equations Simple

Instead of combining many calculations into one equation, break complex problems into smaller steps.

Readers can follow your explanation more easily.

Explain Every Formula

Don't just display an equation.

Tell readers what it represents and when it should be used.

For example, instead of writing only:

$$
F=ma
$$

Explain that it is Newton's Second Law, where:

  • F is force
  • m is mass
  • a is acceleration

A short explanation makes technical documentation much more useful.

Preview Before Publishing

Different platforms may render equations differently.

Always preview your Markdown document before publishing to make sure every equation appears correctly.

Common Mistakes

Many beginners run into the same problems when writing Markdown Math.

Knowing these mistakes can save time.

Forgetting the Dollar Signs

Math expressions must be enclosed with the correct delimiters.

Incorrect:

x^2+y^2=z^2

Correct:

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

Without the delimiters, most Markdown editors will display the text instead of rendering it as math.

Using Inline Math for Large Equations

Long formulas become difficult to read inside a sentence.

Move them into Block Math instead.

Missing Braces

Some commands require braces to group values correctly.

Correct:

x^{10}

Using braces helps avoid formatting errors, especially in more complex expressions.

Assuming Every Markdown Editor Supports Math

Not every Markdown application can render mathematical equations.

Before sharing your document, confirm that the platform supports Markdown Math.

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 extends the capabilities of standard Markdown by allowing you to write mathematical equations using LaTeX syntax. Whether you're creating research papers, technical documentation, engineering notes, or educational content, it provides a simple way to display formulas in a professional and readable format.

In this guide, you learned:

  • What Markdown Math is
  • How Inline Math and Block Math work
  • Common mathematical expressions and symbols
  • How to write fractions, powers, square roots, matrices, and integrals
  • Where Markdown Math is supported
  • The difference between KaTeX and MathJax
  • Best practices for writing mathematical documentation
  • Common mistakes and how to avoid them

Learning Markdown Math opens the door to creating high-quality technical content without leaving your Markdown workflow. Once you're comfortable with the basics, you can write everything from simple equations to advanced mathematical documents while keeping your files clean, portable, and easy to maintain.

Continue Learning

Continue learning Markdown with these guides:

Available now

Coming soon

  • Markdown Examples

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.