# Word Error Rate (WER): Formula, Worked Example, and OCR Limitations

> Word error rate (WER) counts substitutions, deletions and insertions per reference word. Learn the formula, a worked OCR example, WER vs CER and its limits.

Canonical: https://reducto.ai/guides/word-error-rate

## The short answer

Word error rate (WER) is the share of words a system got wrong compared with a reference transcript. You align the system output against the reference, count the minimum number of word substitutions (S), deletions (D) and insertions (I) needed to turn one into the other, and divide by the number of words in the reference (N):

```text
WER = (S + D + I) / N
```

A WER of 0 means a perfect match; lower is better. The metric comes from speech recognition and is widely used for OCR text, but it only measures word sequences. It says nothing about tables, layout or whether extracted fields are correct.

## The WER formula: substitutions, deletions and insertions

<Table html={"<table>\n  <thead>\n    <tr>\n      <th>Error type</th>\n      <th>What happened</th>\n      <th>OCR example (reference → output)</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>Substitution (S)</td>\n      <td>A reference word was read as a different word</td>\n      <td>total → tota1</td>\n    </tr>\n    <tr>\n      <td>Deletion (D)</td>\n      <td>A reference word is missing from the output</td>\n      <td>due by March → due March</td>\n    </tr>\n    <tr>\n      <td>Insertion (I)</td>\n      <td>The output contains a word that is not in the reference</td>\n      <td>amount of → amount of of</td>\n    </tr>\n  </tbody>\n</table>"} />

Two details decide whether a WER calculation is correct:

- **The denominator is N, the reference word count.** Do not divide by the output length or by the number of aligned pairs. An output can have the same length as the reference and still score badly.
- **The counts come from a minimum-edit alignment.** WER is word-level Levenshtein distance, computed with dynamic programming over the alignment with the fewest total edits.

Normalization rules also change the score. Decide up front whether case, punctuation, hyphenation and number formats ("1,250" vs "1250") count as differences, and apply the same rules to every system you compare.

## Word error rate calculation: a worked example

This is a synthetic invoice line written for this guide. The reference is the true text; the output is a plausible OCR result.

- **Reference:** `Remit the total amount of 1,250 dollars by March 3` (10 words)
- **OCR output:** `Remit the tota1 amount of of 1,750 dollars March 3` (10 words)

<Table html={"<table>\n  <thead>\n    <tr>\n      <th>Reference</th>\n      <th>Output</th>\n      <th>Result</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr><td>Remit</td><td>Remit</td><td>Match</td></tr>\n    <tr><td>the</td><td>the</td><td>Match</td></tr>\n    <tr><td>total</td><td>tota1</td><td>Substitution</td></tr>\n    <tr><td>amount</td><td>amount</td><td>Match</td></tr>\n    <tr><td>of</td><td>of</td><td>Match</td></tr>\n    <tr><td>—</td><td>of</td><td>Insertion</td></tr>\n    <tr><td>1,250</td><td>1,750</td><td>Substitution</td></tr>\n    <tr><td>dollars</td><td>dollars</td><td>Match</td></tr>\n    <tr><td>by</td><td>—</td><td>Deletion</td></tr>\n    <tr><td>March</td><td>March</td><td>Match</td></tr>\n    <tr><td>3</td><td>3</td><td>Match</td></tr>\n  </tbody>\n</table>"} />

S = 2, D = 1, I = 1 and N = 10, so:

```text
WER = (2 + 1 + 1) / 10 = 0.40 = 40%
```

Both strings have 10 words, yet 4 edits are needed. The wrong amount (1,250 → 1,750) and the harmless duplicated "of" each count as one error: WER weights every word equally.

You can check the arithmetic with the open-source [jiwer](https://github.com/jitsi/jiwer) Python library. This was run with jiwer 3.1.0:

```python
import jiwer

reference = "Remit the total amount of 1,250 dollars by March 3"
hypothesis = "Remit the tota1 amount of of 1,750 dollars March 3"

out = jiwer.process_words(reference, hypothesis)
print("S", out.substitutions, "D", out.deletions, "I", out.insertions)
print("WER", out.wer)
print("CER", jiwer.cer(reference, hypothesis))
```

```text
S 2 D 1 I 1
WER 0.4
CER 0.16
```

## WER vs CER

Character error rate (CER) uses the same formula at the character level: character edits divided by the number of reference characters. In the example, the reference has 50 characters including spaces. The edits are one character in "tota1", one in "1,750", three for the inserted " of" and three for the deleted "by ", so CER = 8 / 50 = 16%.

<Table html={"<table>\n  <thead>\n    <tr>\n      <th></th>\n      <th>WER</th>\n      <th>CER</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>Unit</td>\n      <td>Words</td>\n      <td>Characters</td>\n    </tr>\n    <tr>\n      <td>Denominator</td>\n      <td>Reference word count</td>\n      <td>Reference character count</td>\n    </tr>\n    <tr>\n      <td>One wrong letter in a word</td>\n      <td>Whole word wrong</td>\n      <td>One character wrong</td>\n    </tr>\n    <tr>\n      <td>Best for</td>\n      <td>Readability and search on word-segmented text</td>\n      <td>Near-misses, IDs and languages without spaces between words</td>\n    </tr>\n  </tbody>\n</table>"} />

Report both. A low CER with a high WER usually means small character mistakes spread across many words.

## What transcription metrics miss in documents

WER compares two flat word sequences. Documents are not flat:

- **Tables.** Cell values can be read perfectly and placed in the wrong row or column. Score structure separately, for example with a table similarity metric.
- **Reading order.** Interleaved columns, sidebars and footnotes show up as many insertions and deletions, or are hidden by how the reference was built.
- **Fields.** A form can have a low WER and a wrong total, date or account number. Measure field-level exact match, precision and recall.

[Most accurate OCR software](https://reducto.ai/guides/most-accurate-ocr-software) and [best OCR models for accuracy, speed and cost](https://reducto.ai/guides/best-ocr-models-accuracy-speed-cost) cover how to combine these metrics in a fair comparison. The [Document AI benchmark guide](https://reducto.ai/guides/document-ai-benchmark-ocr-parsing-extraction) explains why table and extraction scores belong in separate leaderboards.

## How Reducto evaluates beyond WER

Reducto's own benchmarks use edit distance where it fits and separate metrics where it does not. [RD-TableBench](https://reducto.ai/blog/rd-tablebench) uses normalized Levenshtein distance for cell text, then aligns cells and rows with Needleman-Wunsch so structure is scored too. The [r-1 mini evaluation](https://reducto.ai/blog/reducto-r-1-mini-parse-model) counts serious errors per page rather than reporting one word-level number.

The [Parse API](https://reducto.ai/parse) returns text, tables and figures as blocks with bounding boxes, and optional [Parse citations](https://docs.reducto.ai/configs/parse/citations) add word-level boxes and table cell boxes. The [Extract API](https://reducto.ai/extract) returns schema fields with [citations](https://docs.reducto.ai/configs/extract/citations) back to the source. That lets you score text with WER or CER and fields with exact match on the same documents. Try it on your own files in [Reducto Studio](https://studio.reducto.ai).

## Frequently asked questions

### What is a good word error rate for OCR?

There is no universal threshold. It depends on scan quality, language, normalization and use. Set a target on your own documents and track critical fields separately.

### Can WER be greater than 100%?

Yes. Insertions add to the error count but not to the denominator, so an output with many extra words can exceed 100%.

### Is WER the same as accuracy?

No. "Word accuracy" is sometimes reported as 1 − WER, but that number can go negative and still ignores layout, tables and field correctness.

### Should I normalize text before calculating WER?

Usually, yes. Lowercase and strip punctuation if those differences do not matter for your use case, keep number formatting if it does, and apply identical rules to every system.
