e01.org

MathML

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

**Mathematical Markup Language (MathML)** is an [XML](/docs/Web/XML)-based language for describing mathematical notation.

[MathML](https://w3c.github.io/mathml/) was originally designed as a general-purpose specification for browsers, office suites, [computer algebra systems](https://en.wikipedia.org/wiki/Computer_algebra_system), [EPUB](https://www.w3.org/publishing/epub33/) readers, [LaTeX](https://en.wikipedia.org/wiki/LaTeX)-based generators. However, this approach was not very adapted to the Web: the [subset focusing on semantics](https://w3c.github.io/mathml/#contm) has never been implemented in browsers while the [subset focusing on math layout](https://w3c.github.io/mathml/#presm) led to incomplete and inconsistent browser implementations.

[MathML Core](https://w3c.github.io/mathml-core/) is a subset with increased implementation details based on rules from [LaTeX](https://en.wikipedia.org/wiki/LaTeX) and the [Open Font Format](https://learn.microsoft.com/en-us/typography/opentype/spec/math). It is tailored for browsers and designed specifically to work well with other web standards including [HTML](/docs/Web/HTML), [CSS](/docs/Web/CSS), [DOM](/docs/Web/API/Document_Object_Model), [JavaScript](/docs/Web/JavaScript).

Below you will find links to documentation, examples, and tools to work with MathML. MDN uses [MathML Core](https://w3c.github.io/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](https://github.com/w3c/mathml-polyfills) to facilitate that transition.

## Tutorials

The [MathML tutorials](/docs/Web/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](/docs/Web/MathML/Tutorials/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](/docs/Web/MathML/Guides) are resources that help you author MathML on your web pages, including guidance on writing, editors, fonts and more.

- [Authoring MathML](/docs/Web/MathML/Guides/Authoring)
- : Suggestions and tips for writing MathML, including suggested MathML editors and how to integrate their output into Web content.
- [Fonts for MathML](/docs/Web/MathML/Guides/Fonts)
- : How users can install such math fonts to properly display MathML in browsers.

## Reference

The [MathML reference](/docs/Web/MathML/Reference) is a comprehensive list of MathML elements and attributes that are documented on MDN.

- [MathML element reference](/docs/Web/MathML/Reference/Element)
- : Details about each MathML element and compatibility information for desktop and mobile browsers.
- [MathML global attribute reference](/docs/Web/MathML/Reference/Global_attributes)
- : Information about global MathML attributes applicable to all elements.
- [MathML attribute reference](/docs/Web/MathML/Reference/Attribute)
- : Information about MathML attributes that modify the appearance or behavior of elements.
- [MathML attribute values](/docs/Web/MathML/Reference/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](/docs/Web/MathML/Guides/Proving_the_Pythagorean_theorem)
- : Small example showing a proof of the Pythagorean Theorem.
- [Deriving the quadratic formula](/docs/Web/MathML/Guides/Deriving_the_quadratic_formula)
- : Outlines the derivation of the Quadratic Formula.
- [Mozilla MathML test](https://fred-wang.github.io/MathFonts/mozilla_mathml_test/)
- : Original test from the Mozilla MathML project. It contains examples from the [TeXbook](https://en.wikipedia.org/wiki/Computers_and_Typesetting) 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](https://fred-wang.github.io/TeXZilla/examples/customElement.html)
- : A [custom element](/docs/Web/API/Web_components/Using_custom_elements) that accepts [LaTeX](https://en.wikipedia.org/wiki/LaTeX) content.
- [Magnetic field demo](https://fred-wang.github.io/TeXZilla/examples/toImageWebGL.html)
- : A 3D representation of a magnetic field, using [SVG](/docs/Web/SVG) and [WebGL](/docs/Web/API/WebGL_API).
- [Συνάρτηση ζήτα Ρήμαν (el)](https://fred-wang.github.io/MathFonts/%CE%A3%CF%85%CE%BD%CE%AC%CF%81%CF%84%CE%B7%CF%83%CE%B7_%CE%B6%CE%AE%CF%84%CE%B1_%CE%A1%CE%AE%CE%BC%CE%B1%CE%BD.html)
- : A greek article about the Riemann zeta function, with [Web fonts](/docs/Learn_web_development/Core/Text_styling/Web_fonts) from the [Greek Font Society](https://greekfontsociety-gfs.gr/).
- [Pell's equation](https://people.igalia.com/fwang/pell-bigint-mathml/)
- : A JavaScript program to solve Pell's equation using [`BigInt`](/docs/Web/JavaScript/Reference/Global_Objects/BigInt).
- [Lovelace's program for Bernoulli numbers](https://people.igalia.com/fwang/lovelace-jsclass-mathml/)
- : An emulator for Ada Lovelace's program to calculate Bernoulli numbers, using [Private elements](/docs/Web/JavaScript/Reference/Classes/Private_elements).

## Getting help from the community

- [W3C Math Home](https://www.w3.org/Math/)
- [Raise issues on GitHub w3c/mathml repository](https://github.com/w3c/mathml/issues)
- [www-math w3.org mail archive](https://lists.w3.org/Archives/Public/www-math/)

## Tools

- [W3C Validator](https://validator.w3.org/)
- [W3C's wiki page](https://www.w3.org/wiki/Math_Tools)

## Related topics

- [CSS](/docs/Web/CSS)
- [HTML](/docs/Web/HTML)
- [SVG](/docs/Web/SVG)

## Specifications

## Browser compatibility

source: MDN Web Docs mirror · page

Cite this

"MathML". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/MathML

JSON record · API collection · citation policy