Caesar cipher breaker

All 26 shifts tried and ranked by how English the result looks, with quadgram scores, chi-squared and the best decryption.

How it works

A Caesar cipher shifts every letter by the same amount $k$: $y = (x + k) \bmod 26$. With only 26 possible shifts the key cannot hide: decrypt with each one and pick the decryption that reads as English.

To let the computer pick, each candidate gets a score. The chi-squared statistic $\chi^2 = \sum_i (n_i - E_i)^2 / E_i$ compares the letter counts with those expected in English (smaller is better). The quadgram fitness adds up $\log_{10}$ of the English probability of every group of four consecutive letters, so it also rewards the right letter order; it works even on short texts where the counts say little.

The quadgram table behind the score was counted on about five million letters of public-domain English novels. A score of about $-4.3$ per quadgram means English, about $-5.9$ means random letters.

Everything is calculated in your browser. Nothing you type leaves your device.