Loading TexPixel…

TexPixel could not finish loading. Enable JavaScript and reload the page.

Reload
← All docs

OCR Accuracy: How to Calculate It and Improve It

March 25, 2026·5 min read

OCR accuracy tells you how much of the recognized text matches the original. This guide shows how the accuracy rate is calculated, why formulas need stricter metrics than plain text, what accuracy to expect from different inputs, and how to improve it.

How OCR accuracy is calculated

OCR accuracy is measured against a correct reference transcription (the "ground truth"). The standard metrics count the edits needed to turn the OCR output into the reference.

Character Error Rate (CER)

CER = (S + D + I) / N
Character accuracy = 1 − CER
  • S — substituted characters (one character read as another)
  • D — deleted characters (missing from the output)
  • I — inserted characters (extra in the output)
  • N — number of characters in the reference

S + D + I is the edit (Levenshtein) distance between output and reference.

Worked example. The reference is recognition (11 characters) and OCR returns recogmtion: one substitution (n → m) and one deletion (i). CER = (S + D + I) / N = (1 + 1 + 0) / 11 = 18.2%, so character accuracy is 81.8%.

Word Error Rate (WER) applies the same formula to words instead of characters, so a single wrong letter makes the whole word an error. WER is usually higher than CER on the same text, but the two use different denominators and are not directly comparable.

Because insertions are counted, CER can exceed 100% for very noisy output. Reports then usually show accuracy as 0% — a reporting convention, not part of the CER definition.

For a set of documents, add up the edits and the reference characters over all of them: corpus CER = total edits / total reference characters. Averaging per-document CERs gives short documents too much weight.

Why math OCR needs different metrics

Character metrics weigh every character the same, which suits prose but not formulas. x^2 read as x_2 is a single substitution, yet it turns a power into a subscript. Meanwhile \left( versus ( costs several characters without changing what the formula says. So formula recognition is usually measured with:

  • Expression exact match — the share of formulas whose LaTeX is fully correct after normalizing spacing and equivalent commands. This is the closest to "can I use the result without fixing it".
  • Token edit distance — CER computed over LaTeX tokens (\frac, {, x, ^) instead of characters.
  • Rendered match — both formulas are rendered and compared visually, so different but equivalent LaTeX (\dfrac vs \frac in display mode) is not counted as an error. CDM (Character Detection Matching) is a published metric of this kind.

When you compare math OCR tools, check which metric a quoted accuracy uses: 98% character accuracy can still mean that one formula in five needs a fix.

How to measure accuracy on your own documents

  1. Pick 20–50 formulas that represent your real material (printed, handwritten, scanned).
  2. Write the correct LaTeX for each one — this is your reference.
  3. Run them through the OCR tool and record the output.
  4. Count the formulas that match exactly.
  5. Compute the edit distance for every formula (exact matches count as 0) and divide the total by the total number of reference characters or tokens.
  6. Report both: exact-match rate and corpus CER.

What to expect from TexPixel by input type

Input What to expect
Printed formulas (textbooks, papers) Most formulas come out exactly right; check unusual notation
Scanned documents (300 DPI+) Close to printed; faint or skewed scans need more checking
Clean handwritten formulas Usually correct; look-alike symbols (1/l, x/×) cause most fixes
Photos of whiteboards More fixes: glare, angle and overlapping strokes
Low-resolution images (< 72 DPI) Expect errors; rescan or re-photograph

This is qualitative guidance, not a benchmark. Results depend heavily on image quality; to get numbers for your own material, use the method above.

Factors That Affect Accuracy

Image Quality

The single biggest factor. A blurry, low-resolution, or poorly lit image will always produce worse results than a clean scan.

  • Resolution — 150 DPI or higher is recommended. 300 DPI is ideal for documents.
  • Contrast — dark ink on a white background gives the clearest signal to the model.
  • Sharpness — avoid motion blur or out-of-focus shots.

Formula Complexity

Simple single-line equations are recognized with near-perfect accuracy. More complex structures may have occasional errors:

  • Multi-line equation systems
  • Large matrices (6×6 or larger)
  • Heavily nested fractions (3+ levels deep)
  • Non-standard notation or custom symbols

Handwriting Style

Printed (typed) formulas outperform handwritten ones, but TexPixel handles handwriting well when:

  • Letters are clearly formed and not connected (print style, not cursive)
  • Variables are written in distinct sizes (clearly different x and × for example)
  • Spacing between symbols is consistent

What Reduces Accuracy

  • Rotated images — formulas at an angle are harder to parse
  • Overlapping elements — crossed-out work, annotations, or arrows near symbols
  • Pencil on paper — low contrast; try increasing image brightness/contrast before uploading
  • Multiple formulas in one image — crop to the specific formula you need
  • Decorative fonts — calligraphic or stylized mathematical writing

Improving Results

If you're getting errors, try these steps in order:

  1. Increase image resolution — scan at 300 DPI instead of 150 DPI
  2. Improve contrast — use a photo editor to increase brightness and contrast
  3. Crop tightly — remove surrounding text and whitespace
  4. Straighten the image — correct rotation before uploading
  5. Re-photograph — better lighting, closer distance, sharper focus

Reporting Errors

Found a formula type that TexPixel consistently gets wrong? Let us know — accuracy feedback directly improves the model over time.

Contact us at: support@texpixel.com


Further reading: Improve handwriting recognition accuracy: 5 tips →

Upload a formula and test accuracy →

Turn a formula image into editable math

Upload an image, review the recognized formula, and copy LaTeX or export a Word document.

Try TexPixel