Character error rate (CER) is the standard metric for text recognition quality, defined as the minimum number of character substitutions, deletions and insertions needed to turn a system’s output into a reference transcript, divided by the number of characters in the reference. In Document AI, CER is the primary way to report OCR accuracy for printed text, handwriting and scene text, and it complements word-level and field-level metrics used in document extraction.
A CER of 0 percent means a perfect transcription, and lower values are better. Because insertions are counted, CER can exceed 100 percent when a system produces much more text than the reference contains, a detail that often surprises newcomers.
How character error rate is calculated
CER is computed from the Levenshtein edit distance between the hypothesis and the reference string. A dynamic programming alignment finds the cheapest sequence of edits, with each operation usually given a cost of one. The formula is CER = (S + D + I) / N, where S, D and I are substitutions, deletions and insertions, and N is the reference length.
The table illustrates the three error types with short examples.
| Error type | Reference | Recognized text | Edits |
|---|---|---|---|
| Substitution | invoice | inv0ice | 1 |
| Deletion | amount | amout | 1 |
| Insertion | total | totall | 1 |
| Mixed errors | Paris 2024 | Pans 2O24 | 3 |
In the mixed example, “ri” read as “n” counts as one substitution plus one deletion, and the letter O replacing zero is one substitution, so CER is 3 divided by 10, or 30 percent. Corpus-level CER should be computed by summing edits and reference characters across all lines before dividing, not by averaging per-line rates, which overweights short lines.
Some evaluations use weighted edit costs, for example charging less for confusing visually similar characters, but such variants are not comparable with standard CER. A related quantity, character accuracy, is often reported as 1 minus CER; because CER has no upper bound, character accuracy can become negative, so many reports prefer to publish CER directly. When confidence intervals are needed, practitioners usually apply bootstrap resampling over pages or lines, since errors within one page are strongly correlated through shared image quality and layout.
Normalization decisions that change the score
CER is only comparable when text normalization rules are identical. Two evaluations of the same output can differ by several percentage points depending on how whitespace, case and Unicode variants are treated, so careful reports state the normalization explicitly.
| Choice | Options | Effect on the score |
|---|---|---|
| Case sensitivity | Keep or lowercase | Lowercasing removes capitalization errors |
| Whitespace | Keep, collapse or remove | Collapsing hides spacing errors |
| Unicode form | NFC or NFKC | Changes how ligatures and accents count |
| Punctuation | Keep or strip | Stripping lowers CER on noisy scans |
| Line breaks | Count or ignore | Matters for page-level evaluation |
| Diacritics | Keep or remove | Large impact on Czech, French or Vietnamese |
A frequent pitfall is reading order. When a page-level output places two columns in a different order from the reference, CER rises sharply even if every character is correct. For that reason, many benchmarks compute CER per text line or region after alignment.
CER compared with other recognition metrics
CER measures fine-grained transcription quality, whereas downstream tasks often care about whole words or extracted fields. Choosing the right metric depends on how the recognized text is used.
| Metric | Unit of comparison | Best suited for |
|---|---|---|
| Character error rate | Single characters | OCR engines, handwriting, low-resource scripts |
| Word error rate | Whole words | Search, readability, speech-like evaluation |
| Field-level accuracy | Extracted values | Invoice data extraction, form extraction |
| Exact match | Entire string | Identifiers, totals, dates |
| ANLS | Normalized similarity per answer | Document question answering benchmarks |
Word error rate is typically several times higher than CER on the same output, because a single wrong character ruins a whole word. For languages written without spaces, such as Chinese or Japanese, CER is the natural primary metric because word segmentation is itself ambiguous.
Typical values and what they mean
Acceptable CER depends heavily on the material and the use case. Clean printed documents scanned at about 300 dpi can reach CER below 1 percent with modern engines such as Tesseract or transformer-based recognizers, while historical handwriting often remains well above that.
| Document type | Typical CER range | Main error sources |
|---|---|---|
| Clean printed text | Below 1 percent | Rare symbols, ligatures |
| Receipts and faxes | 2 to 8 percent | Low resolution, thermal fading |
| Modern handwriting | 3 to 10 percent | Writer variation, connected letters |
| Historical manuscripts | 5 to 20 percent or more | Abbreviations, damage, old scripts |
| Scene text in photos | Widely variable | Perspective, blur, unusual fonts |
These ranges are indicative rather than fixed, because results depend on training data, image preprocessing such as deskewing and binarization, and the normalization rules in force.
Limitations and common mistakes
CER treats every character error as equally important, which rarely matches business impact. A wrong digit in an amount is far more costly than a missing comma, yet both add one edit.
- Averaging per-page CER gives short pages too much weight.
- Ignoring hallucinated text from generative models hides large insertion errors.
- Comparing CER across datasets with different normalization is misleading.
- Using CER alone for extraction tasks misses whether the right field was captured.
- Evaluating on training-like data overstates performance on new document layouts.
Vision-language models and OCR-free document understanding systems make insertion errors more common, since they may paraphrase or complete text. Reporting separate substitution, deletion and insertion counts alongside CER makes such behavior visible.
Put simply
Character error rate tells you how many letters a reading machine got wrong. You count every letter it changed, skipped or added. Then you divide by the length of the correct text.
Imagine a teacher marking a dictation. Each wrong, missing or extra letter costs one point. Fewer mistakes per hundred letters means better reading. A CER of 2 percent means about two errors in every hundred characters.
In practice
A logistics company digitized about 50,000 scanned delivery notes each month and needed to choose between two OCR engines. The team prepared a test set of 500 notes with manually verified transcriptions and applied the same normalization to both outputs: Unicode NFC, collapsed whitespace and case preserved.
Engine A reached a CER of 1.8 percent, and engine B reached 2.6 percent. However, a breakdown by field showed that engine B made fewer errors in tracking numbers, which mattered most. The team selected engine B for numeric fields and combined CER with field-level exact match in its acceptance criteria, which cut manual correction time by roughly a third.