← All models

image-to-text · image → LaTeX · WASM · ~320 MB

Math-formula OCR — a picture of an equation → LaTeX

Paste, drop or upload an image of a mathematical equation and the model reads it and writes the LaTeX that produces it — fractions, integrals, sums, roots, super/subscripts and all. It's OCR-free end to end: a vision encoder looks at the whole formula and a decoder generates the markup. Everything runs on your device — the image never leaves the tab.

At a glance

ModelXenova/texify (ONNX build of vikp/texify)
Task / pipelineimage-to-text (vision-encoder-decoder)
OutputLaTeX source for the equation in the image
ArchitectureDonut-Swin vision encoder + mBART decoder (OCR-free, generative)
Quantizationq8 (8-bit) ONNX, merged decoder for cached generation
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~320 MB, cached after first load
Licensecc-by-sa-4.0 (base model vikp/texify)

Run it

Paste an image (Ctrl/⌘+V), drop a file, or try a sample. The equation image is read locally and the LaTeX is generated token by token.

Drop an equation image, paste from the clipboard, or:

Why it matters

Math is hard to search, edit or read aloud when it's trapped in a picture. Turning an equation image back into LaTeX — on-device — means you can lift formulas out of textbooks, papers, whiteboards or screenshots without uploading anything.

It's a best-effort recogniser for a single, reasonably clean equation: it nails structure (fractions, integrals, sums, roots) but can slip on an ambiguous character (a stylised E vs H) or very dense/handwritten input. Treat the LaTeX as a strong first draft — the re-typeset preview below makes any slip easy to spot and fix.

How the API works

It's one image-to-text call — the model generates the LaTeX autoregressively:

import { pipeline } from "@huggingface/transformers";

const texify = await pipeline("image-to-text", "Xenova/texify");
const out = await texify(equationImage, { max_new_tokens: 256 });
// → [{ generated_text: "$$x^{2}+y^{2}=z^{2}$$" }]

A Donut-Swin encoder embeds the whole equation image; an mBART decoder generates LaTeX tokens with a KV-cache (merged decoder). It all runs in a Web Worker so the page stays responsive while it decodes.

Use-case ladder

Basics · Token-by-Token LaTeX Decoder Studio

Watch mBART decode LaTeX tokens in real time with arrival timestamps, tune max_new_tokens, compare raw vs cleaned markup, and inspect structural math badges.

Practical · Multi-Equation Snipper & Note Compiler

Drag a crop box over a multi-equation study sheet or uploaded screenshot, recognise each equation into an editable list, and export clean Markdown or LaTeX notes.

Wild · Equation Image → Live 2D Function Plotter

Draw or render a function equation on canvas, run real Texify OCR to recover its LaTeX, parse it safely without eval(), and plot an interactive y = f(x) curve.

Multi-model · Equation-to-Plain-English Math Tutor

Chain two on-device WASM models: Xenova/texify (~320 MB) extracts exact LaTeX from an equation image, then SmolLM2-135M (~140 MB) streams a plain-English explanation.

References