{"slug": "katex", "name": "KaTeX", "category": "dev-libs", "category_name": "Libraries and frameworks", "description": "", "recommenders": 4, "commenters": 16, "warners": 2, "score": 3.292, "rising": -1.31, "first": "2025-11-03", "latest": "2026-07-11", "why": "Overall, I am quite happy with the switch from MathJax to KaTeX.", "why_is_quote": true, "has_verdict": false, "sentiment": {"recommend": 4, "neutral": 7, "compare": 3, "warn": 2}, "spark": [3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], "listed": true, "loved": [], "caveat": "", "short_quote": "Overall, I am quite happy with the switch from MathJax to KaTeX.", "kind": "", "icon": false, "domain": "katex.org", "github_repo": null, "official_url": "https://katex.org", "pricing": "", "aliases": ["KaTeX"], "verdict": null, "praise": [{"label": "", "summary": "", "quotes": [{"id": 769011696, "item_id": 48063231, "url": "https://news.ycombinator.com/item?id=48063231", "by": "eXpl0it3r", "date": "2026-05-08", "stance": "recommend", "quote": "the KaTeX output is consistently better", "excerpt": "Despite the \"Gold-suite\" comparison, when looking at the KaTeX and RaTeX output [1], the KaTeX output is consistently better. RaTeX has either a lot of aliasing going on or appears blurry. But the native and library nature of RaTeX is very interesting, especially with the provided C ABI. [1] https://ratex.lites.dev/demo/support-table", "context": "", "use_case": "", "switched_from": "", "story": "RaTeX: KaTeX-compatible LaTeX rendering engine in pure Rust"}, {"id": 732799152, "item_id": 45799947, "url": "https://news.ycombinator.com/item?id=45799947", "by": "susam", "date": "2025-11-03", "stance": "recommend", "quote": "Since KaTeX produces the spacing and rendering quality I am happy with", "excerpt": "> The size of the circle on the contour integral is a matter of personal preference, but it just depends on the typeface and is orthogonal to the choice of LaTeX/MathML. Indeed! That was precisely the point of my previous comment. I agree that switching to Latin Modern resolves some of the minor issues I mentioned earlier. However, it does not resolve all of them. In particular, it does not address the spacing concer", "context": "", "use_case": "Math typesetting", "switched_from": "", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}, {"id": 732778930, "item_id": 45798683, "url": "https://news.ycombinator.com/item?id=45798683", "by": "susam", "date": "2025-11-03", "stance": "recommend", "quote": "more recently KaTeX, since they get you closer to the typesetting quality of LaTeX compared to MathML", "excerpt": "For someone used to the typesetting quality of LaTeX, MathML leaves much to be desired. For example, if you check the default demo at https://mk12.github.io/web-math-demo/ you'll notice that the contour integral sign (\u222e) has an unusually large circle in the MathML rendering (with most default browser fonts) which is quite inconsistent with how contour integrals appear in print. It's not the fault of MathML of course ", "context": "", "use_case": "", "switched_from": "MathJax", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}, {"id": 732776048, "item_id": 45798503, "url": "https://news.ycombinator.com/item?id=45798503", "by": "bobajeff", "date": "2025-11-03", "stance": "recommend", "quote": "It's fast enough for the side preview and supports all the LaTeX commands I need so far.", "excerpt": "I use this all the time when editing markdown in vscodium. It's fast enough for the side preview and supports all the LaTeX commands I need so far. When I need a PDF Pandoc handles the conversion well enough for me. I've tried using Quarto's preview but it's so slow in comparison.", "context": "", "use_case": "math preview in markdown", "switched_from": "", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}, {"id": 732774800, "item_id": 45798425, "url": "https://news.ycombinator.com/item?id=45798425", "by": "susam", "date": "2025-11-03", "stance": "recommend", "quote": "Overall, I am quite happy with the switch from MathJax to KaTeX.", "excerpt": "I switched from MathJax to KaTeX earlier this year for my blog. So far, it has been working out well. The only feature I really missed was the ability to use \\label and \\eqref for equation referencing, since KaTeX doesn't support these commands [1]. I worked around this limitation with a small custom setup defining my own \\label and a custom \\eqnref (not exactly \\eqref though) [2]. Another thing that bothered me a li", "context": "blog author", "use_case": "math rendering on blog", "switched_from": "MathJax", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}]}], "caveats": [{"label": "", "summary": "", "quotes": [{"id": 776567537, "item_id": 48535471, "url": "https://news.ycombinator.com/item?id=48535471", "by": "franciscop", "date": "2026-06-14", "stance": "warn", "quote": "doing one of the mainstream Markdown renderers + Katex (LaTeX) + Prism.js", "excerpt": "I just wrapped up https://llmrender.com/, a tiny (10kb) Markdown to React renderer works with all of the Markdown + LaTeX math you'd normally expect in a normal project. I made it because doing one of the mainstream Markdown renderers + Katex (LaTeX) + Prism.js (syntax highlight) adds 300kb of gzipped JS to the frontend projects, so with this you can have it all for just 10kb. It also works well with streaming/does s", "context": "", "use_case": "", "switched_from": "", "story": "Ask HN: What are you working on? (June 2026)"}, {"id": 732926721, "item_id": 45807920, "url": "https://news.ycombinator.com/item?id=45807920", "by": "mkl", "date": "2025-11-03", "stance": "warn", "quote": "MathJax lets you select text more often than KaTeX as far as I can tell", "excerpt": "MathJax lets you select text more often than KaTeX as far as I can tell (some KaTeX formulas act dead unless you start selecting outside them), not that either library give you anything especially useful if you try to copy and paste. MathJax will happily give you useful copy-to-clipboard if you right click. MathJax has way more accessibility features: https://docs.mathjax.org/en/latest/basic/accessibility.html", "context": "", "use_case": "", "switched_from": "", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}]}], "who": [{"by": "jerrygoyal", "context": "built Jetwriter AI Chrome extension", "url": "https://news.ycombinator.com/item?id=45806884", "date": "2025-11-03"}, {"by": "susam", "context": "blog author", "url": "https://news.ycombinator.com/item?id=45798425", "date": "2025-11-03"}], "tags": [], "use_cases": ["math rendering", "math typesetting", "latex rendering", "rendering math formulas", "rendering math in ai chat", "interactive math equations"], "compared": [{"slug": "mathjax", "name": "MathJax", "co": 5, "switched_from": 2, "switched_to": 0}, {"slug": "ratex", "name": "RaTeX", "co": 3, "switched_from": 0, "switched_to": 0}, {"slug": "mathml", "name": "MathML", "co": 2, "switched_from": 0, "switched_to": 0}], "makers": [], "threads": [{"url": "https://news.ycombinator.com/item?id=45746063", "title": "KaTeX \u2013 The fastest math typesetting library for the web", "mentions": 12}, {"url": "https://news.ycombinator.com/item?id=48010729", "title": "RaTeX: KaTeX-compatible LaTeX rendering engine in pure Rust", "mentions": 2}, {"url": "https://news.ycombinator.com/item?id=48872791", "title": "Jektex 0.2.0 \u2013 A Jekyll plugin for LaTeX rendering is now ~10x faster", "mentions": 1}, {"url": "https://news.ycombinator.com/item?id=48528779", "title": "Ask HN: What are you working on? (June 2026)", "mentions": 1}, {"url": "https://news.ycombinator.com/item?id=48248141", "title": "Ask HN: Do you have a colophon for your personal website?", "mentions": 1}, {"url": "https://news.ycombinator.com/item?id=47259453", "title": "Show HN: PyMath Preview \u2013 preview LaTeX math in Python docstrings inside VS Code", "mentions": 1}], "sentiment_by_month": {"2025-11": {"compare": 2, "recommend": 3, "neutral": 3, "warn": 1}, "2025-12": {}, "2026-01": {}, "2026-02": {}, "2026-03": {"neutral": 2}, "2026-04": {}, "2026-05": {"compare": 1, "recommend": 1, "neutral": 1}, "2026-06": {"warn": 1}, "2026-07": {"neutral": 1}, "2026-08": {}, "2026-09": {}, "2026-10": {}}, "quotes": [{"id": 781964673, "item_id": 48872792, "url": "https://news.ycombinator.com/item?id=48872792", "by": "yagarea", "date": "2026-07-11", "stance": "neutral", "quote": "Now, I find all expressions on a page and render them in a single bulk KaTeX call.", "excerpt": "I did some benchmarks and found out that the real slowdown is not the LaTeX rendering itself, but calling KaTeX from Ruby. In the previous version, every LaTeX expression meant a separate KaTeX call. Now, I find all expressions on a page and render them in a single bulk KaTeX call. As a result, my personal blog\u2014which contains ~5k LaTeX expressions with nothing cached now builds in 7 seconds instead of 92 seconds. I a", "context": "", "use_case": "LaTeX rendering", "switched_from": "", "story": "Jektex 0.2.0 \u2013 A Jekyll plugin for LaTeX rendering is now ~10x faster"}, {"id": 776567537, "item_id": 48535471, "url": "https://news.ycombinator.com/item?id=48535471", "by": "franciscop", "date": "2026-06-14", "stance": "warn", "quote": "doing one of the mainstream Markdown renderers + Katex (LaTeX) + Prism.js", "excerpt": "I just wrapped up https://llmrender.com/, a tiny (10kb) Markdown to React renderer works with all of the Markdown + LaTeX math you'd normally expect in a normal project. I made it because doing one of the mainstream Markdown renderers + Katex (LaTeX) + Prism.js (syntax highlight) adds 300kb of gzipped JS to the frontend projects, so with this you can have it all for just 10kb. It also works well with streaming/does s", "context": "", "use_case": "", "switched_from": "", "story": "Ask HN: What are you working on? (June 2026)"}, {"id": 771976194, "item_id": 48248512, "url": "https://news.ycombinator.com/item?id=48248512", "by": "WCSTombs", "date": "2026-05-23", "stance": "neutral", "quote": "KaTeX, which I use to pre-render all the math formulas to HTML", "excerpt": "Mine uses Jekyll with a heavily customized Just-the-Docs theme. The other notable technology used on it is KaTeX, which I use to pre-render all the math formulas to HTML when generating the site.", "context": "", "use_case": "rendering math formulas", "switched_from": "", "story": "Ask HN: Do you have a colophon for your personal website?"}, {"id": 769011696, "item_id": 48063231, "url": "https://news.ycombinator.com/item?id=48063231", "by": "eXpl0it3r", "date": "2026-05-08", "stance": "recommend", "quote": "the KaTeX output is consistently better", "excerpt": "Despite the \"Gold-suite\" comparison, when looking at the KaTeX and RaTeX output [1], the KaTeX output is consistently better. RaTeX has either a lot of aliasing going on or appears blurry. But the native and library nature of RaTeX is very interesting, especially with the provided C ABI. [1] https://ratex.lites.dev/demo/support-table", "context": "", "use_case": "", "switched_from": "", "story": "RaTeX: KaTeX-compatible LaTeX rendering engine in pure Rust"}, {"id": 768876497, "item_id": 48054781, "url": "https://news.ycombinator.com/item?id=48054781", "by": "ethmarks", "date": "2026-05-07", "stance": "compare", "quote": "", "excerpt": "> the size of the rust binary The `render` binary weighed 4.0 MB on disk when I compiled it a few minutes ago. Not sure if that's what you were looking for, but just in case it is, there you go. Here's the logs, if you want: https://gist.github.com/ethmarks/8df92a68c3076ea2f4a5aedba9fefa28", "context": "", "use_case": "", "switched_from": "", "story": "RaTeX: KaTeX-compatible LaTeX rendering engine in pure Rust"}, {"id": 756151265, "item_id": 47259454, "url": "https://news.ycombinator.com/item?id=47259454", "by": "sankarebarri", "date": "2026-03-05", "stance": "neutral", "quote": "It uses KaTeX for fast rendering and it is lightweight.", "excerpt": "I\u2019ve been working quite a lot on machine learning recently and often document equations directly in Python comments and docstrings. At first I was just writing them in plain text, like: ax^2 + bx + c = 0 or gradient expressions written out linearly. But as the equations became more complex it quickly became ugly and hard to read inside the code. So I switched to writing them in LaTeX inside docstrings. That solved th", "context": "", "use_case": "math rendering", "switched_from": "", "story": "Show HN: PyMath Preview \u2013 preview LaTeX math in Python docstrings inside VS Code"}, {"id": 755840593, "item_id": 47240037, "url": "https://news.ycombinator.com/item?id=47240037", "by": "ontouchstart", "date": "2026-03-03", "stance": "neutral", "quote": "usually Math is wrapped with KaTeX [2]", "excerpt": "LLMs only produce markdown [1], usually Math is wrapped with KaTeX [2]. The rendering happens in the Web UI. If some math failed to render, you can copy the code and paste to latex-sandbox [3] and fix yourself. [1] https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions [2] https://katex.org [3] https://latex-sandbox.vercel.app", "context": "", "use_case": "math rendering", "switched_from": "", "story": "Ask HN: What prompt do you use to get Claude to consistently render LaTeX?"}, {"id": 733909425, "item_id": 45869339, "url": "https://news.ycombinator.com/item?id=45869339", "by": "stared", "date": "2025-11-09", "stance": "neutral", "quote": "Equations Explained Colorfully (KaTeX + Markdown + TypeScript)", "excerpt": "As a very recent pet project (and pretty much work in progress), Equations Explained Colorfully (KaTeX + Markdown + TypeScript) https://github.com/stared/equations-explained-colorfully Thinking on good export formats (except of taking screenshots and Pull Requests, obviosuly). LaTeX and Typst? A remark plugin?", "context": "", "use_case": "Math rendering", "switched_from": "", "story": "Ask HN: What Are You Working On? (Nov 2025)"}, {"id": 733220432, "item_id": 45826277, "url": "https://news.ycombinator.com/item?id=45826277", "by": "viktorstrate", "date": "2025-11-05", "stance": "compare", "quote": "What benefits does KaTeX provide over MathML which is natively supported by all major browsers", "excerpt": "What benefits does KaTeX provide over MathML which is natively supported by all major browsers, I suppose it can\u2019t be faster than that? https://developer.mozilla.org/en-US/docs/Web/MathML", "context": "", "use_case": "", "switched_from": "", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}, {"id": 732926721, "item_id": 45807920, "url": "https://news.ycombinator.com/item?id=45807920", "by": "mkl", "date": "2025-11-03", "stance": "warn", "quote": "MathJax lets you select text more often than KaTeX as far as I can tell", "excerpt": "MathJax lets you select text more often than KaTeX as far as I can tell (some KaTeX formulas act dead unless you start selecting outside them), not that either library give you anything especially useful if you try to copy and paste. MathJax will happily give you useful copy-to-clipboard if you right click. MathJax has way more accessibility features: https://docs.mathjax.org/en/latest/basic/accessibility.html", "context": "", "use_case": "", "switched_from": "", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}, {"id": 732910144, "item_id": 45806884, "url": "https://news.ycombinator.com/item?id=45806884", "by": "jerrygoyal", "date": "2025-11-03", "stance": "neutral", "quote": "We used KaTeX via a React plugin to render math formulas as part of the AI response", "excerpt": "We used KaTeX via a React plugin to render math formulas as part of the AI response for our AI Writing Chrome extension (Jetwriter AI). We faced many challenges, especially with how different AI models syntax formulas, and had to do some string manipulation to make it work. Sadly, there isn't a go-to KaTeX library that would just work for AI chat apps.", "context": "built Jetwriter AI Chrome extension", "use_case": "rendering math in AI chat", "switched_from": "", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}, {"id": 732844977, "item_id": 45802811, "url": "https://news.ycombinator.com/item?id=45802811", "by": "sureglymop", "date": "2025-11-03", "stance": "neutral", "quote": "I had to serve the js bundle to run in the browser.", "excerpt": "That's news to me! The last time I used Hugo it didn't support that yet and I had to serve the js bundle to run in the browser.", "context": "", "use_case": "", "switched_from": "", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}, {"id": 732799152, "item_id": 45799947, "url": "https://news.ycombinator.com/item?id=45799947", "by": "susam", "date": "2025-11-03", "stance": "recommend", "quote": "Since KaTeX produces the spacing and rendering quality I am happy with", "excerpt": "> The size of the circle on the contour integral is a matter of personal preference, but it just depends on the typeface and is orthogonal to the choice of LaTeX/MathML. Indeed! That was precisely the point of my previous comment. I agree that switching to Latin Modern resolves some of the minor issues I mentioned earlier. However, it does not resolve all of them. In particular, it does not address the spacing concer", "context": "", "use_case": "Math typesetting", "switched_from": "", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}, {"id": 732783216, "item_id": 45798951, "url": "https://news.ycombinator.com/item?id=45798951", "by": "stared", "date": "2025-11-03", "stance": "neutral", "quote": "it uses KaTeX under the hood", "excerpt": "As a very much work-in-progress, yesterday, I started working on interactive equations https://p.migdal.pl/equations-explained-colorfully/ (it uses KaTeX under the hood). The idea is similar to https://betterexplained.com/articles/colorized-math-equations/, but with mouseover interaction (both for further description, but also for accessibility). For a deeper dive in the topic of explorable explanations, I wrote http", "context": "", "use_case": "Interactive math equations", "switched_from": "", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}, {"id": 732778930, "item_id": 45798683, "url": "https://news.ycombinator.com/item?id=45798683", "by": "susam", "date": "2025-11-03", "stance": "recommend", "quote": "more recently KaTeX, since they get you closer to the typesetting quality of LaTeX compared to MathML", "excerpt": "For someone used to the typesetting quality of LaTeX, MathML leaves much to be desired. For example, if you check the default demo at https://mk12.github.io/web-math-demo/ you'll notice that the contour integral sign (\u222e) has an unusually large circle in the MathML rendering (with most default browser fonts) which is quite inconsistent with how contour integrals appear in print. It's not the fault of MathML of course ", "context": "", "use_case": "", "switched_from": "MathJax", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}, {"id": 732776048, "item_id": 45798503, "url": "https://news.ycombinator.com/item?id=45798503", "by": "bobajeff", "date": "2025-11-03", "stance": "recommend", "quote": "It's fast enough for the side preview and supports all the LaTeX commands I need so far.", "excerpt": "I use this all the time when editing markdown in vscodium. It's fast enough for the side preview and supports all the LaTeX commands I need so far. When I need a PDF Pandoc handles the conversion well enough for me. I've tried using Quarto's preview but it's so slow in comparison.", "context": "", "use_case": "math preview in markdown", "switched_from": "", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}, {"id": 732774800, "item_id": 45798425, "url": "https://news.ycombinator.com/item?id=45798425", "by": "susam", "date": "2025-11-03", "stance": "recommend", "quote": "Overall, I am quite happy with the switch from MathJax to KaTeX.", "excerpt": "I switched from MathJax to KaTeX earlier this year for my blog. So far, it has been working out well. The only feature I really missed was the ability to use \\label and \\eqref for equation referencing, since KaTeX doesn't support these commands [1]. I worked around this limitation with a small custom setup defining my own \\label and a custom \\eqnref (not exactly \\eqref though) [2]. Another thing that bothered me a li", "context": "blog author", "use_case": "math rendering on blog", "switched_from": "MathJax", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}, {"id": 732772960, "item_id": 45798310, "url": "https://news.ycombinator.com/item?id=45798310", "by": "koito17", "date": "2025-11-03", "stance": "neutral", "quote": "", "excerpt": "https://gist.github.com/akar1ngo/7d4ea6e9dfc369526beb75092cbd6cb8", "context": "", "use_case": "Math typesetting", "switched_from": "", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}, {"id": 732770945, "item_id": 45798184, "url": "https://news.ycombinator.com/item?id=45798184", "by": "koito17", "date": "2025-11-03", "stance": "recommend", "quote": "I've been using katex-rs, a Rust rewrite", "excerpt": "I've been using katex-rs, a Rust rewrite, to implement LaTeX rendering for a Rust web app. It was easy enough to hook into pulldown_cmark, so that $ and $$ and render a decent subset of LaTeX. Since pulldown_cmark is a proper Markdown parser, you listen for Event::InlineMath and Event::DisplayMath then call KaTeX directly. No regex or HTML escaping necessary. In my web app, this is all encapsulated into a single func", "context": "", "use_case": "", "switched_from": "", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}, {"id": 732764112, "item_id": 45797757, "url": "https://news.ycombinator.com/item?id=45797757", "by": "s20n", "date": "2025-11-03", "stance": "compare", "quote": "I use KaTeX for my blog, and indeed KaTeX was faster than MathJax 2", "excerpt": "I use KaTeX for my blog, and indeed KaTeX was faster than MathJax 2, but MathJax 3 (a complete rewrite) has significantly improved performance from the previous version and is now a bit faster than KaTeX in my experience. This website has a comparison of the loading times of the same LaTeX rendered in both KaTeX and MathJax: https://www.intmath.com/cg5/katex-mathjax-comparison.php", "context": "blogger", "use_case": "math typesetting on blog", "switched_from": "", "story": "KaTeX \u2013 The fastest math typesetting library for the web"}]}