Share math equations as a web page with KaTeX
KaTeX turns LaTeX written inside an HTML page into typeset equations in the browser. Put the stylesheet, two script tags and your text in one HTML file, upload it, and send a link that opens with the math rendered.
A PDF of equations cannot be commented on line by line, and a screenshot cannot be copied or zoomed cleanly. Raw LaTeX in an email is unreadable to anyone without a TeX setup.
KaTeX reads LaTeX between delimiters in an ordinary HTML page and replaces it with typeset math in the browser. One HTML file, hosted at a link, opens with the equations rendered on any device.
Build the page in one file
Create math.html with this structure:
- ✓<!doctype html>, <meta charset="utf-8"> and <meta name="viewport" content="width=device-width, initial-scale=1"> in the head.
- ✓The stylesheet: https://cdn.jsdelivr.net/npm/katex@0.19.1/dist/katex.min.css.
- ✓Two deferred script tags with pinned versions: https://cdn.jsdelivr.net/npm/katex@0.19.1/dist/katex.min.js, then https://cdn.jsdelivr.net/npm/katex@0.19.1/dist/contrib/auto-render.min.js.
- ✓A script that runs once the page loads: document.addEventListener("DOMContentLoaded", () => renderMathInElement(document.body, { delimiters: [{ left: "$", right: "$", display: true }, { left: "\\(", right: "\\)", display: false }] }));
- ✓Your text, with inline math as \(E = mc^2\) and display math on its own between $ and $.
- ✓Tested on KaTeX 0.19.1 in Chrome: one inline and one display equation rendered from a hosted-style page.
Delimiters and errors
A single $ is not in the delimiter list above, so a price such as $5 in the text stays plain text. Adding { left: "
quot;, right: "quot;, display: false } turns on single-dollar math, and then every pair of dollar signs on the page is read as an equation.An unknown command is left on the page as raw LaTeX and logged to the browser console. In testing, \(\foo{x}\) stayed as typed and the console showed "KaTeX parse error: Undefined control sequence: \foo at position 1".
KaTeX covers most of the math commands people use, not every LaTeX package. Check a command against the KaTeX support table before relying on it.
Writing in Markdown, a notebook or Quarto? Sharing a Markdown file as a web page, sharing a Jupyter notebook as a link and sharing a Quarto or R Markdown report cover those exports.
Upload it and send the link
Drag the .html file onto the FileShare Pro dashboard and copy the link. The page opens with the equations typeset, and viewers need no account.
If the page shows raw LaTeX once hosted, open the browser console. "renderMathInElement is not defined" means the auto-render script is missing or loads after the code that calls it. Why an AI page works in chat but breaks when hosted covers pages an assistant wrote.
Turn on comments and readers can leave a note on the page after typing a name. When you fix an equation, upload the new file over the old one and the link stays the same: updating a shared link without changing it.
Frequently asked
Put the KaTeX stylesheet, the KaTeX and auto-render script tags, a renderMathInElement call and your text into one HTML file, upload it to a host that serves HTML as a web page, and send the link.
Single $ is not a delimiter unless you add it. The setup in this guide uses $ for display math and \( \) for inline math, so prices stay plain text.
With auto-render, the expression stays on the page as raw LaTeX and the parse error is logged to the browser console.
Yes. The free plan hosts up to 50 files of up to 100 MB each, with view counts and comments included. Password-protected links are on Pro.
Drop the file, copy the link — live in seconds, free plan included.
Start sharing free