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
.mmlfile 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.
<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
<math …>The root element
Every formula is one
<math>element. A standalone.mmlfile is an XML document with<math>as its root, often after an<?xml version="1.0"?>declaration. - 2
xmlns="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
display="block"Block or inline
blockcentres 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
<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
<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
<mfrac> … </mfrac>A fraction
Exactly two children: the numerator, then the denominator.
- 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
<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
<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
<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
<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:
<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 MathML | Content MathML | |
|---|---|---|
| Describes | Layout and notation | Mathematical meaning |
| Typical elements | <mi>, <mn>, <mo>, <mfrac>, <msup> | <apply>, <ci>, <cn>, <plus/>, <int/> |
| Rendered by browsers | Yes (MathML Core) | No: not part of MathML Core |
| Produced by | Equation editors, LaTeX converters, Word | Computer 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
| Version | Status | What it means today |
|---|---|---|
| MathML 1.0, 1.01 | W3C Recommendations, April 1998 and July 1999 | Historic. |
| MathML 2.0 | Recommendation 2001; Second Edition 2003 | Still offered as an export setting by equation editors such as MathType. |
| MathML 3.0 | Recommendation October 2010; Second Edition April 2014 | The full language: presentation and content markup, line breaking, elementary maths layouts. |
| MathML Core | Candidate Recommendation, June 2025 | The subset browsers implement, with exact rendering rules and shared tests. |
| MathML 4 | Working 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:
<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
mathfont family; you can name one, such asfont-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
.mmlfile on a server. Chromium 141 downloaded our.mmlsample served asapplication/mathml+xml. Served asapplication/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
| Tool | How it uses MathML |
|---|---|
| Microsoft Word | Stores 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 Math | Tools, 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. |
| MathType | Copies equations as MathML or LaTeX (Ctrl+Shift+X shows the MathML of an open equation) and accepts pasted MathML or LaTeX. |
| LaTeX converters | Temml, 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.
⁢(invisible times) betweenaandc, and⁡(function application) aftersin, tell a screen reader thatacis a product andsin θ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?
| Symptom | Usual cause | Fix |
|---|---|---|
| Letters in a row, no fractions or roots | The elements aren't in the MathML namespace (an XML or XHTML page without xmlns), or the browser is very old | Add xmlns="http://www.w3.org/1998/Math/MathML" to <math>, or use an HTML page |
| Nothing appears at all | The file is Content MathML, which browsers don't render | Convert it to presentation markup, or wrap both in <semantics> |
| Brackets or a box are missing | <mfenced> or <menclose>, which MathML Core doesn't include | Use <mo> brackets in an <mrow>; draw boxes with CSS |
| Ugly or uneven symbols | No font with a MATH table on the device | Name a maths font in CSS, such as STIX Two Math or Cambria Math |
| Short dash instead of a minus | A hyphen-minus (-) typed inside <mo> | Use U+2212 (−) |
| The file downloads instead of displaying | Opened on its own; browsers render MathML inside pages | Embed 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.mmlreports 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, orpandoc --mathmlfor 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.
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.
Comments 1 and 2: the quadratic formula
A block formula built from
<mi>,<mn>and<mo>tokens, with<mfrac>, a stretching<msqrt>and<msup>.Comment 3: inline maths
Pythagoras and Euler's identity inside a sentence, set smaller to fit the line.
Comments 4 and 5: large operators
A sum with limits above and below (
<munderover>) and an integral with limits to the side (<msubsup>).Comment 6: a limit
<munder>places h → 0 under lim, and the prime is a U+2032 character in its own<mo>.Comment 7: a matrix
<mtable>rows and cells between brackets that stretch to the table's height.Comment 8: roots and accents
A cube root with
<mroot>, and a vector arrow placed with<mover accent="true">.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.htmlin 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.htmlwith NVDA, JAWS or VoiceOver and check that it's read as a fraction, not a string of letters. - Importers: load
sample-formulas.mmlinto LibreOffice Math (Tools, Import Formula) or paste it into Word, and compare the result with the preview. - Content vs presentation: paste
sample-content.mmlinto 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
- MathML Core (W3C Candidate Recommendation)
- MathML Recommendation version history (W3C)
- MathML 4.0 (W3C Working Draft, October 2026)
- IANA media type registration: application/mathml+xml
- Igalia: MathML is back in Chromium (Chrome 109)
- NVDA release notes (MathCAT built in from 2026.1)
Last reviewed 27 October 2026.