Tesseract

Also known as: Tesseract OCR

On this page 7

Tesseract (also called Tesseract OCR) is an open-source optical character recognition engine that converts images of printed or typed text into machine-readable text. In Document AI, it is the most widely deployed free OCR component, often used as the text extraction stage before layout analysis, key information extraction or document question answering.

Tesseract was originally developed at Hewlett-Packard between 1985 and 1994, released as open source in 2005 and later maintained with significant support from Google. Since version 4, its main recognizer is a long short-term memory (LSTM) neural network that reads whole text lines, and it ships trained models for more than 100 languages under the Apache 2.0 license.

How Tesseract recognizes text

Tesseract recognizes text through a pipeline of page analysis followed by line-level recognition. The engine first finds text regions, then splits them into lines and words, and finally passes each line image to the LSTM model, which outputs a character sequence.

The main stages of the pipeline and their outputs are listed in the following table.

StageWhat happensOutput
BinarizationConverts the image to black and white using Otsu thresholdingBinary page image
Page layout analysisDetects blocks, columns and text regionsOrdered text blocks
Line findingGroups connected components into baselinesText line images
LSTM recognitionReads each line as a sequenceCharacter strings with confidences
Output renderingWrites the requested formatsPlain text, hOCR, ALTO, TSV or searchable PDF
Stages of the Tesseract pipeline

The LSTM recognizer is trained with connectionist temporal classification (CTC), which lets the model learn character sequences without explicit character segmentation. This approach handles touching and broken characters far better than the legacy engine, which segmented characters and matched them against shape prototypes.

Key settings and model choices

Tesseract output quality depends heavily on a few configuration parameters. Choosing the wrong page segmentation mode is one of the most frequent causes of missing or scrambled text.

ParameterTypical valuesEffect
Page segmentation mode (–psm)3 automatic, 6 single block, 7 single line, 11 sparse textHow the page is split before recognition
OCR engine mode (–oem)1 LSTM only, 0 legacy, 2 combinedWhich recognizer runs
Language (-l)eng, deu, ces, eng+fraModel and dictionary used
Image resolution300 dpi recommendedCharacter size seen by the model
Character whitelistDigits only, uppercase onlyRestricts allowed output characters
Important Tesseract parameters

Three families of trained models exist. The tessdata_fast models are smaller and quicker, tessdata_best models are more accurate but slower, and the default tessdata set balances the two. Users can fine-tune a model on their own fonts or scripts with the tesstrain tooling when out-of-the-box accuracy is insufficient.

Preprocessing that determines accuracy

Tesseract performs best on clean, high-contrast, upright images with text roughly 20 to 40 pixels high. Its built-in binarization is simple, so real-world scans and phone photos usually need preprocessing before recognition.

The table below links common image problems to their visible symptoms and the usual fix.

ProblemSymptom in outputTypical fix
Skewed scanLines merged or split incorrectlyDocument deskewing
Curved pageErrors increase toward the bindingDocument dewarping
Low resolutionConfused similar characters such as rn and mRescale to about 300 dpi
Uneven lightingMissing text in dark or bright areasAdaptive document image binarization
Noise and stampsRandom symbols in outputDenoising and morphological filtering
Tables and bordersLines read as charactersRemove ruling lines before OCR
Image problems and corrective preprocessing

Because many teams skip these steps, Tesseract is sometimes judged inaccurate when the real cause is poor input quality. On clean printed documents, character error rates of roughly 1 to 2 percent are typical, while degraded scans can produce far higher error rates.

Tesseract compared with other OCR options

Tesseract is a general-purpose printed text recognizer, not a full document understanding system. It returns text and positions but does not understand tables, forms or reading order in complex layouts.

OptionStrengthMain limitation
TesseractFree, offline, many languagesWeak on handwriting and complex layouts
PaddleOCRStrong detection on scene and rotated textHeavier deep learning stack
ABBYY FineReaderHigh accuracy and layout retentionCommercial license
Google Cloud Document AIManaged OCR with form and table parsersCloud processing and usage fees
OCR-free models (Donut, Nougat)End-to-end structured outputNeed GPUs and domain tuning
Tesseract and alternative approaches

In modern pipelines, Tesseract often supplies words and bounding boxes to a layout-aware language model such as LayoutLM, or to tools like Docling that combine layout detection with OCR. This division of labor keeps costs low while adding structural understanding.

Limitations to plan for

Tesseract has well-known weaknesses that should guide tool selection before a project starts.

  • Handwriting: the standard models are trained on printed text and perform poorly on cursive or handwritten notes.
  • Complex layouts: multi-column magazines, forms and nested tables often produce a wrong reading order.
  • Scene text: text on signs, packaging or curved surfaces needs a dedicated detector first.
  • No semantic extraction: fields such as invoice totals require separate key information extraction.
  • CPU throughput: high volumes require parallel processing, since the engine runs single-threaded per page by default.

The simple explanation

Tesseract is free software that reads text from pictures. You give it a scan or a photo of a page. It gives back the words as text you can search, copy and edit.

It works like a careful reader who reads one line at a time. It is very good with clean printed pages. It struggles with messy handwriting or crooked, blurry photos. A cleaner image means better results, much like a person reads a sharp page faster than a smudged one.

How it is used in practice

A municipal archive wants to make 40,000 scanned council records from the 1970s searchable. The team scans pages at 300 dpi, deskews them, removes dark borders and applies adaptive binarization. It then runs Tesseract with the LSTM engine, the English model and page segmentation mode 3, producing searchable PDF files with an invisible text layer and hOCR files with word positions.

Processing runs on an ordinary eight-core server overnight across several batches. A manual sample of 200 pages shows that typed pages reach about 98 percent character accuracy, while pages with handwritten annotations remain partly unreadable and are flagged for review using low word confidence scores. The archive gains full-text search across decades of records without licensing costs, and staff spend their manual effort only on the flagged pages.