LaTeX-OCR (pix2tex) is an open-source tool that converts images of mathematical formulas into LaTeX code, using a Vision Transformer model trained for the image-to-markup task. Point it at a screenshot or photo of an equation and it returns the LaTeX source you can paste straight into a document, paper or notebook. It can be used from the command line, through a graphical interface that captures screenshots for you, or as a Python library and API. The project has gathered more than 16,000 stars on GitHub, with its latest updates in 2025.
Retyping complex equations by hand is slow and error-prone, and general OCR tools struggle with mathematical notation. pix2tex was trained specifically on rendered formulas, so it understands fractions, integrals, superscripts and the rest of the LaTeX vocabulary. Install it with pip and the model checkpoints download automatically. The CLI converts image files or clipboard contents; the GUI (launched as latexocr) lets you snip a region of your screen and immediately see the rendered prediction via MathJax, with the LaTeX copied to your clipboard. It runs locally on your own machine, so formulas from unpublished work never leave your computer.
LaTeX-OCR is completely free and open source under the MIT license. There are no accounts or paid tiers.
LaTeX-OCR is for students, researchers and technical writers who regularly move formulas from PDFs, slides or photos into LaTeX documents, and for developers adding equation recognition to note-taking or publishing tools.