MathJax 2 vs 3 vs 4: Differences Explained with Live Examples

MathJax 3 is a complete rewrite of MathJax 2, and MathJax 4 builds on version 3 with new fonts and line breaking. This page compares all three versions in one table, then shows the differences you can see for yourself in the live preview.

Open the MathJax 2, 3 and 4 live preview →

Quick comparison

Feature MathJax 2 MathJax 3 MathJax 4
Status Legacy, no longer developed Stable (3.2.2) Current
Configuration MathJax.Hub.Config() in a text/x-mathjax-config script window.MathJax object Same as 3
Re-render after page load MathJax.Hub.Queue(["Typeset", MathJax.Hub]) MathJax.typesetPromise() Same as 3
CDN file mathjax@2.7.9/MathJax.js?config=… mathjax@3/es5/tex-chtml.js mathjax@4/tex-chtml.js
Output formats HTML-CSS, CommonHTML, SVG, NativeMML CommonHTML, SVG CommonHTML, SVG
Default font MathJax TeX MathJax TeX New Computer Modern (mathjax-newcm)
Automatic line breaking Optional, off by default Not supported On for inline math; display math needs displayOverflow: 'linebreak'
\color{red}{x} + y Colours only x Colours x + y (works like LaTeX) Same as 3
mhchem chemistry Older version; \pu doesn't work by default Current version, loads automatically on \ce or \pu Same as 3
$...$ inline math Off by default Off by default Off by default
\$ for a literal dollar sign Off by default (processEscapes) On by default On by default
AsciiMath Included in TeX-MML-AM_* configs Must be loaded separately Must be loaded separately
Ignore class tex2jax_ignore mathjax_ignore mathjax_ignore

MathJax 2 vs MathJax 3

This is the big jump. MathJax 3 was rewritten in TypeScript and renders much faster than MathJax 2, but almost everything you write to set it up changes:

The MathJax 2 to 3 migration guide covers each change with before-and-after code.

MathJax 3 vs MathJax 4

MathJax 4 keeps the version 3 configuration and API, so most sites can upgrade by changing the script URL. The visible differences are:

See the differences live

Each link opens an example in the live preview, rendered in MathJax 2, 3 and 4 side by side:

Which version should you use?

Test your own content

The quickest way to find out what changes for your site is to paste real content into the MathJax live preview and compare MathJax 2.7.9, 3.2.2 and 4.1.3 side by side.

Compare your content in MathJax 2, 3 and 4 →