Logo

fxTeX Server

LaTeX Equation Rendering for the Web

- Beautiful mathematics, Lightning-fast -

Running since 2005, and used daily by 150,000+ websites & apps.

v1.0.67
Equation Editor fxTeX fxRender

Important — The CodeCogs rendering tools are changing

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.

Equation Rendering

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)" />

URL Options

A request is /type.format?LaTeX. type is what is produced, format is how it arrives:

TypeProduces
mathmlMathML markup, with spoken text for screen readers.
svgA vector image, every character an outline — needs no font installed.
svgtextThe same, characters left as text. Smaller and selectable, but needs the font.
pngThat SVG rendered to a bitmap.
gifThe 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" />

FormatDelivery
imageThe result itself — markup for mathml, the image bytes otherwise.
jsonA JSON object wrapping the result, with any conversion errors.
downloadAs image, but sent as a file download.

Access and registration covers licensing and domains; the Documentation covers the rest.

MathML CSS

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">

LaTeX already in your page: latexit.js

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:

AttributeEffect
data-typesvg (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-keyA 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

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.

Authentication

Rendering needs a licence, from fxeditor.codecogs.com. Most sites need no key and no code.

From your own website

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.

From an app or a server

Where there is no page to check, send the key as a header:

X-API-Key: fx_pk_…

Where only a URL is possible

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.

Examples:

\alpha + \frac{2\beta}{\gamma}

https://latex.codecogs.com/mathml.image?\alpha + \frac{2\beta}{\gamma}

MATHML
Loading…
\lim_{x \to 0} f(x) = 8

https://latex.codecogs.com/svg.image?\lim_{x\to0} f(x) = 8

SVG
\lim_{x \to 0} f(x)=8
\int \frac{1}{x} dx = \ln \left| x \right| + C

https://latex.codecogs.com/png.image?\int_a^b \frac{1}{x} dx = \ln \left| x \right| + C

PNG
\int \frac{1}{x} dx = \ln \left| x \right|
e^{i\pi} + 1 = 0

https://latex.codecogs.com/gif.image?e^{i\pi}+1=0

GIF
e^{i\pi}+1=0
\alpha + \frac{2\beta}{\gamma}

https://latex.codecogs.com/mathml.json?\alpha + \frac{2\beta}{\gamma}

JSON
Loading…

Further examples →