How to Convert an Image to a Formula (LaTeX)
Turn a photo or screenshot of a math equation into editable LaTeX. Three methods compared, plus where to paste the result and how to shoot handwriting.
You have a photo of an equation and you need it as text you can edit — not a picture, not a flattened string like x^2/2 + C. Retyping it symbol by symbol in Word’s equation editor takes minutes and you will get a subscript wrong. This guide covers how to do it in seconds, and what to do with the result afterwards.
Quick answer
- Fastest, any device: upload the image to ExtractFromIMG → Extract Text. Formulas come back as LaTeX and are rendered on the page so you can check them visually before copying.
- One or two formulas, no upload allowed: type them in Word’s equation editor (
Alt + =), which accepts LaTeX input. - Large batches, fully offline: run
pix2tex(the LaTeX-OCR project) locally.
What “image to formula” actually produces
There are two very different things people mean by “convert an image to a formula”, and it helps to know which one you want.
A rendered formula — something that looks like the original, laid out properly, that you can drop into a document. Fractions stack, integrals get their limits, matrices get brackets.
LaTeX source — the markup behind it, e.g. \int_0^\infty e^{-x^2}\,dx = \frac{\sqrt{\pi}}{2}. This is what you actually want if you are going to edit the equation, because any tool that can render LaTeX can re-render it after you change a symbol.
A good OCR tool gives you both: the rendered preview so you can spot mistakes at a glance, and the source so you can fix them. Tools that only show you a picture of the formula are a dead end — you cannot edit a screenshot.
How LaTeX is delimited
When you copy the source, formulas are wrapped in dollar signs:
| Form | Delimiters | Use for |
|---|---|---|
| Inline math | $ ... $ | A symbol inside a sentence, e.g. the limit $x \to 0$ |
| Display math | $$ ... $$ | A standalone equation on its own line |
Most editors expect these delimiters. When you paste into something that has its own math input field, you usually need to strip the $ signs first.
Method 1: browser tool (fastest, and free)
- Open extractfromimg.com.
- Drag in the image, click to upload, or paste a screenshot with
Ctrl + V(Cmd + Von Mac). JPG, PNG, WebP, HEIC, GIF and BMP up to 10MB. - Click Extract Text.
- The result appears as a rendered preview — check the formulas look right, then switch to the raw view to copy the LaTeX, or download the page as Markdown.
The reason this works better than generic screenshot OCR is that the document model analyses layout first. It knows a fraction is a fraction and a superscript is a superscript, instead of reading the page as one flat line of characters. For a page that mixes prose, notation and a table, you get all three back in their original structure.
If you only want the general text-extraction workflow, see how to extract text from an image instead.
Method 2: Word’s equation editor (no upload)
If the formula is short and you would rather not upload anything:
- In Word, press
Alt + =to insert an equation. - On the Equation tab, set Conversions to LaTeX.
- Type or paste the LaTeX body — without the
$delimiters. - Press
Enteror click Convert → Current – Professional to render it.
This is fine for one equation you can mostly remember. It is not a practical way to transcribe a page of a textbook, because you are still the OCR engine.
Method 3: run it locally with pix2tex
If you have a few hundred formulas, or the images are confidential and cannot leave your machine, pix2tex is an open-source LaTeX OCR model you can run on your own hardware:
pip install pix2tex
pix2tex path/to/equation.png
It needs Python and pulls in PyTorch, so the first install is heavy. Accuracy depends on the model version and how clean the crop is — it works best on a single, tight image of one equation rather than a full page.
Which method should you use?
| Situation | Best option |
|---|---|
| One screenshot, want it in 30 seconds | ExtractFromIMG |
| A whole page with prose, tables and equations | ExtractFromIMG — keeps the document structure |
| Handwritten lecture notes | ExtractFromIMG |
| Can’t upload the image, short formula | Word equation editor |
| Hundreds of images, have Python and a GPU | pix2tex, batch scripted |
| Need it inside Excel or Word as a document | ExtractFromIMG → export .docx or .xlsx |
Where to paste LaTeX once you have it
| Target | What to do |
|---|---|
| Overleaf | Paste directly into the .tex file. |
| Obsidian | Paste anywhere — $...$ renders out of the box via MathJax. |
| Notion | Type /math for an inline equation, or create an equation block and paste the source inside it. |
| Jupyter | Paste into a Markdown cell. |
| Word | Alt + = to insert an equation, switch to LaTeX conversion, paste the body without the $. |
| Google Docs | No native LaTeX paste — you need the equation toolbar or a third-party add-on. |
Why handwriting is harder than print
Handwritten formulas fail for boring, physical reasons, and you can fix most of them before taking the photo:
- Ambiguous glyphs.
1andl,2andz,\alphaanda, an integral sign and a longs. Resolution helps more than anything else. - Shadows across the page. A phone held over a notebook casts a shadow on exactly the part you need. Shoot in even, indirect light.
- Angle. Shoot perpendicular to the page. A 30° tilt turns rectangles into trapezoids and confuses column detection.
- Too much context. One equation per image beats a full page of notes with four equations and a margin doodle.
- Ruled and grid paper. The lines compete with the fraction bars. Plain paper gives noticeably cleaner results.
Common failure modes, and how to spot them
| Symptom | What probably happened |
|---|---|
1/2 instead of \frac{1}{2} | The model read the slash, not the stacked layout. Fine semantically, may look different. |
x2 instead of x_2 | Subscript collapsed onto the baseline. Check every subscript on the first pass. |
| Greek letters turned into Latin ones | Low resolution or an unusual handwriting style. |
| Multi-line derivation merged into one line | Alignment environments (align) are not recovered — split them yourself. |
| Brackets the wrong size | \left( / \right) lost; cosmetic, easy to add back. |
None of these are catastrophic, but all of them are easier to catch while the image is still open next to the result than after you have pasted the formula into a paper.
FAQ
Can I convert a screenshot of an equation, not a photo?
Yes, and it is the easiest case — screenshots are sharp, evenly lit and free of perspective distortion. Paste with Ctrl + V rather than saving the file first.
Does it handle multi-line derivations?
Each line comes back as its own display formula. The alignment characters in an align environment are not reliably preserved, so if you need a properly aligned derivation in a paper you will add the & markers yourself.
Will it work on a formula inside a PDF page? Screenshot the region and upload that. Formulas embedded in a PDF are vector text, but exporting a crop as an image is the most reliable path.
What about chemical notation?
Subscripts in formulas like H₂SO₄ come back correctly as H_2SO_4. Balancing a reaction is not something OCR does — it only reads what is written.
Is it really free? Yes. No account, no credit card, no quota to unlock. Your image is processed and discarded; nothing is stored on the server.