Skip to content
induwara.lk
Premium
induwara.lkMachine learning · Evaluation

Character Error Rate (CER) Calculator

Paste a reference and a model output to get the Character Error Rate, accuracy, and an exact substitution / deletion / insertion breakdown with a colour-coded character diff. Matches jiwer.cer(), runs entirely in your browser — no signup, no upload.

By Induwara AshinsanaUpdated Jul 8, 2026
Character Error Rate
Stays on your device.0 chars
Stays on your device.0 chars
Options
Examples
CER
Character accuracy
Total errors (S+D+I)
Reference length (N)

Runs entirely in your browser — text is never uploaded, logged, or stored. Method: character-level minimum-edit-distance (Levenshtein) alignment, CER = (S + D + I) / N, per the HuggingFace evaluate CER metric and jiwer. Up to 20,000 characters per box.

How it works

Character Error Rate is the character-level counterpart of Word Error Rate. It measures how far a predicted text — from an OCR engine, speech-to-text model, or handwriting recogniser — has drifted from the ground truth, counted one character at a time. The definition used here is the one published in the HuggingFace evaluate CER metric and implemented by the jiwer library:

CER = (S + D + I) / N

where S is the number of substituted characters, D the deletions, I the insertions, and N the number of characters in the reference. The calculator produces these four numbers in three steps:

  1. Normalise.Both strings are lower-cased (unless “case sensitive” is on), runs of whitespace collapse to a single space, punctuation is optionally stripped, and spaces are optionally dropped. This mirrors the default text handling in jiwer and keeps the comparison fair.
  2. Align.The two character sequences are aligned with minimum edit distance — a full Levenshtein dynamic-programming table with unit cost for every substitution, insertion, and deletion. The table is then backtraced to recover the exact operation sequence, so S, D, and I are counted from a real alignment rather than guessed. This is the same alignment convention used by NIST’s SCTK / sclite scoring toolkit for ASR benchmarks.
  3. Divide and cross-check.The total error count S + D + I equals the Levenshtein distance between the two strings, so an independent two-row edit-distance routine recomputes that distance and confirms it agrees. Only then is the result marked “cross-checked”. CER is that total divided by N, and accuracy is max(0, 1 − CER).

Because insertions are counted while the denominator stays fixed at the reference length, CER is unbounded above: a hypothesis far longer than the reference can score over 100%. That is expected behaviour, not a bug — the HuggingFace metric card notes the same. When the reference is empty after normalisation, N is zero and CER is undefined (division by zero); the tool detects this and shows a specific message instead of a silent NaN. Characters are compared as Unicode code points, so Sinhala, Tamil, and emoji are handled — with the caveat that combining characters count as separate code points (grapheme-aware CER is a planned enhancement).

Worked examples

ref hello world

hyp helo world

  1. Reference length N = 11 characters (space counted)
  2. Alignment: one 'l' is dropped → 1 deletion
  3. S = 0, D = 1, I = 0 → S + D + I = 1
  4. CER = 1 / 11 = 0.0909 → 9.09%
  5. Accuracy = 1 − 0.0909 = 90.91%

ref the cat sat

hyp teh cet sat

  1. Reference length N = 11 characters
  2. 'the' → 'teh' costs 2 substitutions (h↔e; Levenshtein has no swap op)
  3. 'cat' → 'cet' costs 1 substitution (a→e); 'sat' unchanged
  4. S = 3, D = 0, I = 0 → S + D + I = 3
  5. CER = 3 / 11 = 0.2727 → 27.27%

ref run

hyp running

  1. Reference length N = 3 characters
  2. Alignment: insert 'n', 'i', 'n', 'g' → 4 insertions
  3. S = 0, D = 0, I = 4 → S + D + I = 4
  4. CER = 4 / 3 = 1.3333 → 133.33% (over 100%)
  5. Accuracy = max(0, 1 − 1.3333) = 0% (clamped)

Frequently asked questions

Sources & references

The formula and worked examples were last reconciled against the HuggingFace CER metric card and jiwer.cer() on 2026-07-08. Each live result is additionally cross-checked by an independent edit-distance pass shown in the badge above the tool.

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.