Skip to main content

BLEU Score Calculator

Scores a candidate text against one or more reference texts with BLEU, showing modified 1- to 4-gram precisions, the brevity penalty and the length ratio.

For checking machine translation or generated text by hand.

Last updatedHow we build & check our tools
Results will appear here once you enter your values.

The formula

BLEU = BP × exp( (1/N) Σ log pₙ ) × 100, where N is your max n-gram order, pₙ is the modified n-gram precision and BP is the brevity penalty. Weights are equal across orders.

  • Tokens: split on whitespace, case-sensitive, punctuation not separated. Cat. and cat are different tokens.
  • Multiple references: one per line; blank lines are ignored. Clipping uses the highest count in any single reference.
  • Limits: up to 20,000 tokens per text and 50 reference lines; max n-gram must be a whole number from 1 to 4.

Worked example

Candidate: the cat is on the mat (6 tokens). Reference: there is a cat on the mat (7 tokens).

  • Precisions: 5/6 = 0.8333 for unigrams (the is clipped to 1 match), 2/5 = 0.4 for bigrams, 1/4 = 0.25 for trigrams and 0/3 = 0 for 4-grams.
  • Brevity penalty: exp(1 − 7/6) = 0.8465; length ratio 0.8571.
  • Max n-gram 4, no smoothing: BLEU 0, because the 4-gram precision is zero.
  • Max n-gram 4, add-one: precisions become 0.8333, 0.5, 0.4 and 0.25, giving BLEU 38.24.
  • Max n-gram 2, no smoothing: BLEU 48.87.

The three scores differ widely for the same sentence, which is why the settings must be reported with any BLEU figure.

Limits and sources

  • Sentence-level instability: BLEU was designed for corpora. Single-sentence scores are noisy.
  • Tokenization: without a language-aware tokenizer, punctuation and word forms reduce matches, especially for languages without spaces.
  • Overlap only: it cannot detect meaning-preserving rewordings.

Sources: Papineni, K., Roukos, S., Ward, T. and Zhu, W.-J. (2002), BLEU: a method for automatic evaluation of machine translation, Proceedings of ACL, 311-318. Lin, C.-Y. and Och, F. J. (2004), ORANGE: a method for evaluating automatic evaluation metrics for machine translation, Proceedings of COLING.

Frequently Asked Questions

Common questions about the BLEU Score Calculator

For each n-gram order from 1 up to the max you choose, the tool counts how many candidate n-grams appear in the references, capping each n-gram at the most times it appears in any single reference. That clipped count divided by the total candidate n-grams is the modified precision. BLEU is the geometric mean of those precisions, multiplied by a brevity penalty, scaled to 0 to 100.

From the same team

Stop paying per token — route AI requests to your own GPU

Wide Area AI is a local-first AI gateway: repeated requests hit an edge cache, the rest run free on your own hardware, and the cloud is only a failover. OpenAI-compatible endpoint, free tier.

Start routing — free

Explore More Tools

Explore these related tools for your next step.

ai
ai
ai
ai
ai
ai