How OCR Works and Why It Makes Mistakes (and How to Reduce Them)

A plain-English look at how optical character recognition turns a picture into text, why it confuses O and 0 or rn and m, and what you can do to improve accuracy.

Optical character recognition, or OCR, feels like magic the first time: you drop in a photo of a page and a moment later you have text you can edit. Understanding what happens in that moment explains why OCR is excellent on some pictures and surprisingly bad on others, and it tells you what to change when the result is poor.

Step 1: clean up the picture

The engine first prepares the image. It may convert it to black and white, adjust contrast, remove specks of noise and straighten pages that are slightly tilted. A page that is tilted by a few degrees can be corrected. One that is badly rotated, curved or photographed from a steep angle is much harder to fix. The “Auto-Enhance” option in Image to Text does a version of this clean-up, boosting contrast and sharpening edges, which helps on dim photos.

Step 2: find the layout

Next the software divides the page into regions: paragraphs, columns, tables, pictures. Then it finds lines of text and the words within them. This step explains many odd results. If the page has two columns, the engine must decide to read down the first and then down the second. If it gets this wrong, you receive sentences stitched together from both columns. Tables are harder still, since each cell looks like a separate small block.

Step 3: recognise the characters

The core of OCR is recognition. Older engines compared each letter to stored shapes. Modern engines, including the Tesseract engine that powers many free tools, use neural networks that look at a whole line of text and predict the sequence of characters, a bit like reading a word rather than spelling it out letter by letter. They are trained on huge numbers of examples of text in a given language, which is why you choose a language before you run the tool: the model needs to know which alphabet and which patterns to expect.

Step 4: use the language to fix guesses

Finally, the engine uses what it knows about the language to correct itself. If the shapes could be “clock” or “dock”, the sentence around them helps. This is why running the wrong language gives poor results, and why OCR is weakest where there is no language to lean on, such as a random code, a licence plate or a long invoice number.

Why mistakes happen

How to get better results

  1. Improve the source. A sharp, straight, evenly lit picture is worth more than any setting. Read how to scan with your phone camera.
  2. Choose the right language before you run the tool.
  3. Crop to the text you need. Fewer decorations mean fewer false characters.
  4. Use Auto-Enhance for dim or low-contrast pictures.
  5. Run one column or one block at a time if the layout is complex.
  6. Prefer originals. Text in a digital PDF can be extracted without OCR at all, which is exact. Use OCR only when the page is a picture.

Proofreading checklist

No matter how good the picture is, treat OCR text as a first draft, not as a final copy. Read the numbers twice: amounts, dates, phone numbers, ID numbers and email addresses are where a single wrong character does real harm. Compare names with the original. Look for words that are split in two or joined together. For legal, financial or medical documents, always check the final text against the original page.

OCR in a browser, privately

Docsworker runs OCR on your own device using code that your browser downloads, so your picture is not uploaded. That is useful for receipts, forms and personal letters. The trade-off is speed: a long document on an older phone can take a while. For a PDF that is a scan, PDF to Text will run the same recognition page by page, and this guide explains how to tell whether you need OCR at all.

Try it now: Image to Text (OCR)Free, no sign-up, and your files stay in your browser.
Open Image to Text (OCR)

Frequently asked questions

What does OCR stand for?

Optical character recognition: software that reads the letters and numbers in a picture and turns them into text a computer can edit and search.

Why does OCR confuse 0 and O or 1 and l?

In many fonts these characters look almost the same. The engine uses the surrounding letters and its language data to guess, and it sometimes guesses wrong, especially in codes, serial numbers and invoices where there are no words to give a clue.

Is OCR always accurate on printed text?

No. Clean printed text in a common font can be read very well, but accuracy drops with blur, low resolution, skew, shadows, unusual fonts and complicated layouts. Always proofread numbers and names.

Does the OCR on Docsworker send my image anywhere?

No. The recognition runs in your browser. Only the language data file is downloaded the first time you use a language.

Keep reading