Running since 2005, and used daily by 150,000+ websites & apps.
What has changed: our online LaTeX rendering service is now called fxTeX Server, and it is MathML-based. It still renders every equation beautifully from the same simple URL you already use, and generated the same SVG, PNG, GIF and now MATHML formats — only now around 100,000× faster and with embedded accessibility for SVG and MATHML.
fxTeX Server works behind the scenes to rapidly deliver equations to website pages, through the use of a simple URL in the form:
https://latex.codecogs.com / type . format ? LaTeX-Markup
This is typically used within a single HTML image tag, which is the fastest and easiest way to add mathematics to any existing website e.g.:
<img src="https://latex.codecogs.com/svg.image?1+sin^2(x)" />
A request is /type.format?LaTeX. type is what is produced, format is how it arrives:
| Type | Produces |
|---|---|
| mathml | MathML markup, with spoken text for screen readers. |
| svg | A vector image, every character an outline — needs no font installed. |
| svgtext | The same, characters left as text. Smaller and selectable, but needs the font. |
| png | That SVG rendered to a bitmap. |
| gif | The same, as a GIF. |
mathml, svg and svgtext include the spoken form of the equation by default (see Accessibility). Add _nospeech for a more compact result without it — mathml_nospeech, svg_nospeech, svgtext_nospeech:
<img src="https://latex.codecogs.com/svg_nospeech.image?1+sin^2(x)" alt="1 + sin squared x" />
| Format | Delivery |
|---|---|
| image | The result itself — markup for mathml, the image bytes otherwise. |
| json | A JSON object wrapping the result, with any conversion errors. |
| download | As image, but sent as a file download. |
Access and registration covers licensing and domains; the Documentation covers the rest.
MathML is rendered by your browser. Since 2023 most modern browsers do this well. However, if you want to small improvements to the layout then fxTeX can produce additional styles that are scoped to equations it generates. To enable this add these lines to the top of your HTML page:
<link rel="stylesheet" href="https://latex.codecogs.com/fxtex.css">
Write the LaTeX straight into your HTML and let one script turn it into equations from this server:
<p>Inline $a^2+b^2=c^2$, or displayed \[\int_0^1 x\,dx\]</p>
<div lang="latex">\frac{1}{2}</div>
<script src="https://latex.codecogs.com/latexit.js" data-type="mathml"></script>
<script>LatexIT.add('p', true);</script>
Any element marked lang="latex" is converted whole, as a displayed equation, with no further code. LatexIT.add(selector, true) also looks inside the matching elements for $…$ and \(…\) (inline) and \[…\] (displayed); write \$ for a dollar sign that is not maths.
Configure it with attributes on the <script> tag:
| Attribute | Effect |
|---|---|
data-type | svg (the default), svgtext, png or gif each become an <img>. mathml is fetched and placed in the page itself, so it reflows, scales and copies with the text around it — and fxtex.css is linked for you. |
data-speech | "false" asks for the _nospeech form of mathml, svg or svgtext. Speech is on by default. |
data-key | A licence key, for pages whose domain is not the registered one. See Authentication. |
The same settings can be made in script, before the page finishes loading: LatexIT.type = 'mathml'; LatexIT.speech = false;
Accessibility comes with mathml and the SVG images (svg, svgtext), and is on by default. png and gif carry none — give their <img> an alt instead.
SVG images have the spoken form built into the image, so a screen reader reads the equation out wherever the image is used — an <img> tag needs nothing more:
<svg role="img" aria-label="x squared" …>
MathML has to become part of the page itself, not an image, for a reader to reach it — which is what latexit.js with data-type="mathml" does. mathml carries the spoken form of the equation — the words a screen reader reads out, generated from the finished MathML — alongside the equation itself. The <math> is marked aria-hidden and the spoken text sits beside it, so a reader announces one or the other but never both:
<span class="cc-math fxtex"><math aria-hidden="true" …>…</math><span class="cc-speech">x squared</span></span>
That spoken text is hidden from sight by the stylesheet above, so link fxtex.css whenever you use mathml (latexit.js does this for you) — without it the words appear as ordinary text next to the equation. If you would rather not, ask for mathml_nospeech, which returns the bare <math> and leaves accessibility to the browser's own MathML support.
Rendering needs a licence, from fxeditor.codecogs.com. Most sites need no key and no code.
Nothing to add. A licence covers its domain and everything beneath it — example.com also renders on shop.eu.example.com — and the browser sends the page address for you.
Where there is no page to check, send the key as a header:
X-API-Key: fx_pk_…
An <img> tag, a wiki, a CMS field. The same key goes first in the path:
https://latex.codecogs.com/fx_pk_…/svg.image?1+\sin(x^2)
A key in a URL is visible to anyone reading the page. Use the header where you can.
An unidentified or unregistered request still renders — with a small notice added beneath it, rather than failing. See Access and registration for what that looks like and how to remove it.
https://latex.codecogs.com/mathml.image?
https://latex.codecogs.com/svg.image?
https://latex.codecogs.com/png.image?
https://latex.codecogs.com/gif.image?
https://latex.codecogs.com/mathml.json?
Loading…