MathML

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2023.

Mathematical Markup Language (MathML) is an XML-based language for describing mathematical notation.

MathML was originally designed as a general-purpose specification for browsers, office suites, computer algebra systems, EPUB readers, LaTeX-based generators. However, this approach was not very adapted to the Web: the subset focusing on semantics has never been implemented in browsers while the subset focusing on math layout led to incomplete and inconsistent browser implementations.

MathML Core is a subset with increased implementation details based on rules from LaTeX and the Open Font Format. It is tailored for browsers and designed specifically to work well with other web standards including HTML, CSS, DOM, JavaScript.

Below you will find links to documentation, examples, and tools to work with MathML. MDN uses MathML Core as a reference specification but, due to an erratic standardization history, legacy MathML features may still show up in existing implementations and web content.

Note: It is highly recommended that developers and authors switch to MathML Core, perhaps relying on other web technologies to cover missing use cases. The Math WG is maintaining a set of MathML polyfills to facilitate that transition.

Tutorials

The MathML tutorials are designed to walk you through topics assuming that you have no prior experience, starting from the basics and progressing to more advanced techniques.

MathML for beginners

This tutorial will guide you through creating math formulas using structured markup. It starts with an introduction to adding MathML to an HTML document, followed by a deep dive into key components: fractions and roots, scripted elements, and text containers. The tutorial then covers tabular layouts for matrices and advanced math formatting. Finally, a challenge tests your understanding by having you recreate three famous mathematical formulas using the learned concepts.

Guides

The MathML guides are resources that help you author MathML on your web pages, including guidance on writing, editors, fonts and more.

Authoring MathML

Suggestions and tips for writing MathML, including suggested MathML editors and how to integrate their output into Web content.

Fonts for MathML

How users can install such math fonts to properly display MathML in browsers.

Reference

The MathML reference is a comprehensive list of MathML elements and attributes that are documented on MDN.

MathML element reference

Details about each MathML element and compatibility information for desktop and mobile browsers.

MathML global attribute reference

Information about global MathML attributes applicable to all elements.

MathML attribute reference

Information about MathML attributes that modify the appearance or behavior of elements.

MathML attribute values

Further information about MathML attribute values.

Examples

Below you'll find some examples you can look at to help you to understand how to use MathML.

MathML formulas

The following demos display increasingly complex mathematical concepts in Web content.

Proving the Pythagorean theorem

Small example showing a proof of the Pythagorean Theorem.

Deriving the quadratic formula

Outlines the derivation of the Quadratic Formula.

Mozilla MathML test

Original test from the Mozilla MathML project. It contains examples from the TeXbook with image references generated by TeX.

Other Web technologies

The following demos mix MathML with other Web technologies to produce advanced content.

<la-tex> custom element

A custom element that accepts LaTeX content.

Magnetic field demo

A 3D representation of a magnetic field, using SVG and WebGL.

Συνάρτηση ζήτα Ρήμαν (el)

A greek article about the Riemann zeta function, with Web fonts from the Greek Font Society.

Pell's equation

A JavaScript program to solve Pell's equation using BigInt.

Lovelace's program for Bernoulli numbers

An emulator for Ada Lovelace's program to calculate Bernoulli numbers, using Private elements.

Getting help from the community

Tools

Specifications

Specification
Mathematical Markup Language (MathML) Version 4.0

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
math
Chrome – Partial support
Chrome 24 – 24 (Release date: 2013-01-10)
footnote Removed in 25 and later
footnote Partial support
footnote Removed in Chrome 25 because code was not yet production ready.
footnote See bug 40289400
Chrome – Full support
Chrome 109 (Release date: 2023-01-10)
footnote Full support
Edge – Full support
Edge 109 (Release date: 2023-01-12)
footnote Full support
Firefox – Partial support
Firefox 1 – 3.6 (Release date: 2004-11-09)
footnote Partial support
footnote Only supported in XHTML documents.
Firefox – Full support
Firefox 4 (Release date: 2011-03-22)
footnote Full support
Opera – Partial support
Opera 9.5 – 12.1 (Release date: 2008-06-12)
footnote Removed in 15 and later
footnote Partial support
footnote Only supported in XHTML documents.
Opera – Full support
Opera 95 (Release date: 2023-02-01)
footnote Full support
Safari – Full support
Safari 5.1 (Release date: 2011-07-20)
footnote Full support
Chrome Android – Full support
Chrome Android 109 (Release date: 2023-01-10)
footnote Full support
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – Partial support
Opera Android 10.1 – 12.1 (Release date: 2010-11-09)
footnote Removed in 14 and later
footnote Partial support
footnote Only supported in XHTML documents.
Opera Android – Full support
Opera Android 74 (Release date: 2023-03-13)
footnote Full support
Safari on iOS – Full support
Safari on iOS 5 (Release date: 2011-10-12)
footnote Full support
Samsung Internet – Full support
Samsung Internet 21 (Release date: 2023-05-19)
footnote Full support
WebView Android – Full support
WebView Android 109 (Release date: 2023-01-10)
footnote Full support
WebView on iOS – Full support
WebView on iOS 5 (Release date: 2011-10-12)
footnote Full support
display
Chrome – Full support
Chrome 109 (Release date: 2023-01-10)
footnote Full support
Edge – Full support
Edge 109 (Release date: 2023-01-12)
footnote Full support
Firefox – Full support
Firefox 1 (Release date: 2004-11-09)
footnote Full support
Opera – Full support
Opera 95 (Release date: 2023-02-01)
footnote Full support
Safari – Full support
Safari 5.1 (Release date: 2011-07-20)
footnote Full support
Chrome Android – Full support
Chrome Android 109 (Release date: 2023-01-10)
footnote Full support
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – Full support
Opera Android 74 (Release date: 2023-03-13)
footnote Full support
Safari on iOS – Full support
Safari on iOS 5 (Release date: 2011-10-12)
footnote Full support
Samsung Internet – Full support
Samsung Internet 21 (Release date: 2023-05-19)
footnote Full support
WebView Android – Full support
WebView Android 109 (Release date: 2023-01-10)
footnote Full support
WebView on iOS – Full support
WebView on iOS 5 (Release date: 2011-10-12)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
Has more compatibility info.