File types · Explainer

The MathML file (.mml)

A MathML file describes mathematical formulas in XML, so that browsers can draw them as real, selectable maths and screen readers can speak them. This guide explains what's inside one, the difference between presentation and content markup, which browsers render it, and has free sample MathML files to download for testing.

At a glance

Full name
Mathematical Markup Language
Extensions
.mml for standalone files; most MathML lives inside .html and .xhtml pages
MIME type
application/mathml+xml; also application/mathml-presentation+xml and application/mathml-content+xml
Kind
Plain text (XML markup)
Namespace
http://www.w3.org/1998/Math/MathML
Standard
W3C Math Working Group: MathML 3.0 is a Recommendation, MathML Core a Candidate Recommendation, MathML 4 a Working Draft
First released
1998: MathML 1.0 became a W3C Recommendation on 7 April
Renders in
Chrome and Edge 109 and later, Firefox and Safari, when the MathML is inside an HTML page
Opens with
Any text editor; LibreOffice Math and MathType import it
Magic number
None; files start with <?xml or <math

The basics

What is a MathML (.mml) file?

MathML is the web's standard markup for mathematics, published by the W3C. Where an image of an equation is just pixels, MathML records the structure: this is a fraction, this is its numerator, this is an exponent. A browser can then draw it at any size in the page's colours, a reader can select and copy it, and a screen reader can speak or braille it.

Most MathML never sits in a .mml file of its own. It's written straight into HTML pages, EPUB e-books and XHTML documents, or produced on the fly from LaTeX by tools such as Temml, KaTeX, MathJax and Pandoc. A .mml file is MathML saved on its own, usually one formula, as an exchange format between equation editors, office suites and publishing pipelines.

Three things MathML is not:

  • Not LaTeX. LaTeX is a typesetting language you type; MathML is structured XML that software reads. Converters go from LaTeX to MathML routinely, and the reverse is harder.
  • Not a picture. It's drawn by the browser from text, so it scales, reflows and adapts to dark mode like the rest of the page.
  • Not shown when opened on its own. A browser renders MathML inside a page. Open a .mml file by itself and you usually see code or get a download, depending on the browser and the server.

Anatomy

What's inside a MathML file

MathML builds a formula from nested elements, much as you'd describe it aloud: x equals a fraction, whose top is minus b plus or minus a square root… Here is the quadratic formula as a complete .mml file, part by part. Every element name starts with m.

quadratic.mml
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mi>x</mi>
  <mo>=</mo>
  <mfrac>
    <mrow>
      <mo>−</mo>
      <mi>b</mi>
      <mo>±</mo>
      <msqrt>
        <msup><mi>b</mi><mn>2</mn></msup>
        <mo>−</mo>
        <mn>4</mn><mi>a</mi><mi>c</mi>
      </msqrt>
    </mrow>
    <mrow><mn>2</mn><mi>a</mi></mrow>
  </mfrac>
</math>
  1. 1<math …>

    The root element

    Every formula is one <math> element. A standalone .mml file is an XML document with <math> as its root, often after an <?xml version="1.0"?> declaration.

  2. 2xmlns="http://www.w3.org/1998/Math/MathML"

    The namespace

    Required in standalone files and in XHTML. Inside an ordinary HTML page you can leave it out: the HTML parser puts <math> and everything in it into the MathML namespace by itself.

  3. 3display="block"

    Block or inline

    block centres the formula on its own line and uses full-size fractions and limits. Without it the formula is inline, sized to sit in a line of text.

  4. 4<mi>x</mi>

    An identifier

    Variables and function names. A single letter is drawn in italic; a longer name such as <mi>sin</mi> is upright.

  5. 5<mo>=</mo>

    An operator

    Operators, relations, brackets and separators. The browser looks each one up in an operator dictionary to decide the spacing around it and whether it stretches.

  6. 6<mfrac> … </mfrac>

    A fraction

    Exactly two children: the numerator, then the denominator.

  7. 7<mrow> … </mrow>

    A group

    Bundles several elements into one, so −b ± √… can be the single numerator <mfrac> expects. Grouping also tells screen readers and line breaking how the parts belong together.

  8. 8<mo>−</mo>

    A real minus sign

    U+2212, not the hyphen on your keyboard. A hyphen-minus inside <mo> is drawn shorter in some browsers and fonts, which is why converters write U+2212.

  9. 9<msqrt> … </msqrt>

    A square root

    The radical sign grows to cover whatever is inside. <mroot> takes a second child for other roots, such as a cube root.

  10. 10<msup><mi>b</mi><mn>2</mn></msup>

    A superscript

    Base first, then the exponent. <msub> and <msubsup> handle subscripts and both at once.

  11. 11<mn>2</mn>

    A number

    Numbers are upright. Marking them as <mn> rather than plain text is what lets software tell 2 from the letter b.

Two vocabularies

Presentation MathML vs Content MathML

MathML has two vocabularies. Presentation MathML (<mi>, <mo>, <mfrac>…) describes what a formula looks like; it's what browsers render and what nearly every tool produces. Content MathML (<apply>, <ci>, <cn> and operators such as <plus/> and <int/>) describes what it means, so a computer algebra system could evaluate it. This is ∫₀¹ x² dx = 1/3 in Content MathML:

sample-content.mml (excerpt)
<apply><eq/>
  <apply><int/>
    <bvar><ci>x</ci></bvar>
    <lowlimit><cn>0</cn></lowlimit>
    <uplimit><cn>1</cn></uplimit>
    <apply><power/><ci>x</ci><cn>2</cn></apply>
  </apply>
  <cn type="rational">1<sep/>3</cn>
</apply>
Presentation MathMLContent MathML
DescribesLayout and notationMathematical meaning
Typical elements<mi>, <mn>, <mo>, <mfrac>, <msup><apply>, <ci>, <cn>, <plus/>, <int/>
Rendered by browsersYes (MathML Core)No: not part of MathML Core
Produced byEquation editors, LaTeX converters, WordComputer algebra and some publishing and education tools

Content MathML shows nothing in a browser

When we pasted sample-content.mml into an HTML page, Chromium 141 drew nothing at all: the formula took up zero pixels. To keep both, MathML's <semantics> element wraps a presentation form, which browsers draw, with an <annotation-xml> holding the content form or an <annotation> holding, say, the LaTeX source.

History

MathML versions and browser support

VersionStatusWhat it means today
MathML 1.0, 1.01W3C Recommendations, April 1998 and July 1999Historic.
MathML 2.0Recommendation 2001; Second Edition 2003Still offered as an export setting by equation editors such as MathType.
MathML 3.0Recommendation October 2010; Second Edition April 2014The full language: presentation and content markup, line breaking, elementary maths layouts.
MathML CoreCandidate Recommendation, June 2025The subset browsers implement, with exact rendering rules and shared tests.
MathML 4Working Draft (latest October 2026)A superset of Core. Adds the intent attribute, which tells assistive technology how to read an expression.

Firefox and Safari have rendered MathML for many years. Chrome's engine inherited MathML code from WebKit but removed it in 2013; MathML Core arrived in Chrome 109 in January 2023, work led by Igalia, and in Edge 109, which is built on Chromium. Since then every major browser renders MathML without JavaScript.

Core leaves out parts of MathML 3 that were rarely implemented. In our Chromium 141 tests, <mfenced> drew its contents without any brackets, and <menclose notation="circle"> drew no circle. Write brackets as <mo> elements inside an <mrow> instead; converters such as Temml already do.

On the web

Putting MathML in a web page

In HTML you write <math> straight into the page, with no namespace and no script:

page.html
<p>The area of a circle is
  <math><mi>π</mi><msup><mi>r</mi><mn>2</mn></msup></math>.
</p>
  • Fonts. Good maths rendering needs a font with an OpenType MATH table, which holds the stretchy brackets, radical signs and spacing rules. Browsers default to one through the math font family; you can name one, such as font-family: "STIX Two Math", "Cambria Math", math.
  • Script-based renderers. MathJax and KaTeX draw maths with their own HTML and fonts and were the only reliable option before Chrome 109. They're still useful for LaTeX input and for consistent output across browsers; Temml converts LaTeX to native MathML.
  • A .mml file on a server. Chromium 141 downloaded our .mml sample served as application/mathml+xml. Served as application/xml, it rendered, but as an XML document without the page styling. To show a formula to readers, put it in an HTML page.

Tools

How Word, LibreOffice, MathType and LaTeX tools use MathML

ToolHow it uses MathML
Microsoft WordStores equations in its own format, OMML. Its Equation Options can copy equations as MathML (a setting VBA exposes as OMathCopyLF), and pasting MathML into Word turns it into an editable equation.
LibreOffice MathTools, Import MathML from Clipboard, and Tools, Import Formula for .mml files. The file needs the MathML xmlns. LibreOffice warns that its own StarMath language isn't fully compatible, so check the result.
MathTypeCopies equations as MathML or LaTeX (Ctrl+Shift+X shows the MathML of an open equation) and accepts pasted MathML or LaTeX.
LaTeX convertersTemml, KaTeX and MathJax turn LaTeX maths into MathML for web pages; Pandoc does the same when converting documents to HTML or EPUB. sample-from-latex.mml below came from Temml.

Copy and paste is where most MathML travels: from Word or MathType into a web editor, a learning platform or an accessibility checker. If a pasted formula comes out as plain text, the receiving app probably doesn't accept MathML from the clipboard.

Accessibility

MathML and screen readers

Accessibility is MathML's strongest argument over images. An image of an equation can only carry alt text, which flattens the structure into a sentence. MathML lets a screen reader speak the formula, let the user move through it piece by piece, and output it as braille.

  • NVDA reads MathML with MathCAT, built in since NVDA 2026.1; the older MathPlayer add-on is no longer supported.
  • JAWS reads MathML in speech and braille.
  • VoiceOver on macOS and iOS reads MathML in Safari.
  • Invisible operators help. &#x2062; (invisible times) between a and c, and &#x2061; (function application) after sin, tell a screen reader that ac is a product and sin θ a function, not a word.
  • intent, from the MathML 4 draft, lets authors say how an ambiguous expression should be read aloud, for example that a superscript T means transpose.

Troubleshooting

Why does my MathML show as plain text, or not at all?

SymptomUsual causeFix
Letters in a row, no fractions or rootsThe elements aren't in the MathML namespace (an XML or XHTML page without xmlns), or the browser is very oldAdd xmlns="http://www.w3.org/1998/Math/MathML" to <math>, or use an HTML page
Nothing appears at allThe file is Content MathML, which browsers don't renderConvert it to presentation markup, or wrap both in <semantics>
Brackets or a box are missing<mfenced> or <menclose>, which MathML Core doesn't includeUse <mo> brackets in an <mrow>; draw boxes with CSS
Ugly or uneven symbolsNo font with a MATH table on the deviceName a maths font in CSS, such as STIX Two Math or Cambria Math
Short dash instead of a minusA hyphen-minus (-) typed inside <mo>Use U+2212 (&#x2212;)
The file downloads instead of displayingOpened on its own; browsers render MathML inside pagesEmbed the <math> element in an HTML page

How to

How to open, edit and convert a MathML file

  • Read or edit it: any text or code editor; it's XML, so an XML-aware editor can check the syntax. xmllint --noout file.mml reports well-formedness errors.
  • See it rendered: paste the <math> element into an HTML page and open that in a browser, or import it into LibreOffice Math.
  • LaTeX to MathML: Temml (temml.renderToString(tex, { xml: true }) in JavaScript), KaTeX, MathJax, or pandoc --mathml for whole documents.
  • MathML to LaTeX: MathType and some online converters can do it, though not every structure maps back cleanly.
  • Into Word: paste the MathML; Word converts it to an editable equation.

Free downloads

Sample MathML files to download

Free sample MathML files for testing renderers, editors, converters and screen readers. The .mml files are well-formed XML in the MathML namespace; the HTML page passes the W3C Nu validator and renders in current browsers.

sample-page.html · 6.7 KBDownloadOpen

What's inside sample-page.html

The preview shows sample-page.html, a page of formulas drawn by your browser with no scripts or images. Open it in a text editor and each numbered comment marks one of these parts.

  1. Comments 1 and 2: the quadratic formula

    A block formula built from <mi>, <mn> and <mo> tokens, with <mfrac>, a stretching <msqrt> and <msup>.

  2. Comment 3: inline maths

    Pythagoras and Euler's identity inside a sentence, set smaller to fit the line.

  3. Comments 4 and 5: large operators

    A sum with limits above and below (<munderover>) and an integral with limits to the side (<msubsup>).

  4. Comment 6: a limit

    <munder> places h → 0 under lim, and the prime is a U+2032 character in its own <mo>.

  5. Comment 7: a matrix

    <mtable> rows and cells between brackets that stretch to the table's height.

  6. Comment 8: roots and accents

    A cube root with <mroot>, and a vector arrow placed with <mover accent="true">.

  7. Comment 9: an annotation

    <semantics> shows the formula and keeps its LaTeX source in an <annotation> that browsers don't display.

All sample MathML files

  • HTML page with MathML

    sample-page.html · 6.7 KB (6,878 bytes)

    Nine formulas in MathML Core inside an HTML page, block and inline, with numbered comments and dark-mode colours. No JavaScript, web fonts or images.

    • Checking a browser, viewer or e-reader renders MathML
    • Testing screen readers on real formulas
  • Standalone .mml file

    sample-formulas.mml · 1.9 KB (1,916 bytes)

    An XML declaration and one <math> root with a table of four formulas: the quadratic formula, Pythagoras, Euler's identity and a sum.

    • Importing into LibreOffice Math or MathType
    • Testing `.mml` uploads and XML parsers
  • Content MathML

    sample-content.mml · 887 bytes

    ∫₀¹ x² dx = 1/3 described by meaning: <apply>, <int/>, a bound variable, limits and a rational number. Browsers don't render it.

    • Testing tools that read or convert Content MathML
    • Showing the difference from presentation markup
  • Converted from LaTeX

    sample-from-latex.mml · 2.0 KB (2,012 bytes)

    The normal distribution's density, converted from LaTeX by Temml 0.14, with the LaTeX source kept in an <annotation>.

    • Seeing what LaTeX converters produce
    • Testing `<semantics>` and annotation handling

Ways to test with them

  • Rendering: open sample-page.html in the browser or e-reader you care about. Every formula should show stacked fractions, a stretched root sign and a matrix in tall brackets.
  • Screen readers: move through the quadratic formula in sample-page.html with NVDA, JAWS or VoiceOver and check that it's read as a fraction, not a string of letters.
  • Importers: load sample-formulas.mml into LibreOffice Math (Tools, Import Formula) or paste it into Word, and compare the result with the preview.
  • Content vs presentation: paste sample-content.mml into a page; if anything appears, the renderer supports more than MathML Core.

Free to use for testing, teaching and demos, commercially or not, with no attribution needed. A link back to this page is always appreciated.

Put it online

Have a MathML file? Give it a link.

Drop a .mml file on 99helpers and it gets its own address; opened in a browser, it shows as text. To have readers see rendered formulas, put the MathML inside an HTML page and host that.

Questions

MathML files, frequently asked

What is a .mml file?

Usually a MathML file: a mathematical formula written in XML, used to exchange equations between equation editors, office suites, publishing tools and web pages.

How do I open a .mml file?

Any text editor shows the markup. To see the formula, paste its <math> element into an HTML page and open it in a browser, or import it into LibreOffice Math or MathType.

Which browsers support MathML?

All the major ones: Firefox and Safari for many years, and Chrome and Edge since version 109 (January 2023). They implement MathML Core, the part of MathML designed for browsers.

What's the difference between MathML 3 and MathML Core?

MathML 3 is the full language, including Content MathML and many layout options. MathML Core is the subset browsers implement, with precise rendering rules. MathML 4, still a draft, is a superset of Core.

Should I use MathML or LaTeX on a website?

Write in LaTeX if that's easier, then convert it to MathML for the page with a tool such as Temml, KaTeX or Pandoc. Readers get native, accessible formulas without loading a large script.

Can Word open MathML?

The usual route is to paste: Word accepts MathML from the clipboard and turns it into an editable equation, and it can copy its own equations out as MathML.

Is MathML accessible to screen readers?

Yes, it's the most accessible way to publish maths on the web. NVDA (with MathCAT built in since 2026.1), JAWS and VoiceOver can read it aloud and let users explore the formula's parts.

Why does my MathML show nothing in the browser?

It's probably Content MathML, which browsers don't render, or it uses elements outside MathML Core such as <mfenced>. Use presentation markup with brackets written as <mo> elements.

Related formats

Other file types explained

Keep going

Related

Sources

Last reviewed 27 October 2026.