Caesar Cipher

Encrypt and decrypt with the Caesar shift, Vigenère, Atbash and A1Z26 ciphers, and crack unknown Caesar and Vigenère messages by letter frequency.

Converter Text & Encoding Updated Oct 3, 2026
How to Use
  1. Choose a cipher: Caesar, Vigenère, Atbash or A1Z26 (letters to numbers).
  2. Choose Encrypt or Decrypt, type your text, and set the shift or keyword. The result updates as you type.
  3. Don’t know the key? Press Crack: every Caesar shift is tried and ranked by how English the result looks, and for Vigenère the key length and keyword are worked out from letter statistics.
  4. Click any row in the ranking to use that shift. Capitals, spaces and punctuation are kept as they are.
Input
places, 0–25
0 letters
Presets
Cipher
Letters
—
Key
—
Possible keys
—
English score χ²
—

Worked Example

Caesar, shift 3: H (8th letter) + 3 = 11th letter, K. E + 3 = H, L + 3 = O, O + 3 = R, so HELLO becomes KHOOR. Near the end of the alphabet it wraps: X + 3 = 24 + 3 = 27, and 27 − 26 = 1, so X becomes A.

Vigenère, key LEMON: write the key under the message, repeating it, and shift each letter by its key letter (A = 0, B = 1 … Z = 25).
ATTACKATDAWN plus LEMONLEMONLE: A + L(11) = L, T + E(4) = X, T + M(12) = F (19 + 12 = 31, wrap to 5), A + O(14) = O, C + N(13) = P … giving LXFOPVEFRNHR. Notice the three As in the message became L, O and E — that is what defeats simple letter counting.

Show Work

Type a message above to see each letter worked out.

Formulas

Caesar
E(x) = (x + k) mod 26
Decrypt with (x − k) mod 26; A = 0 … Z = 25
Vigenère
Ci = (Pi + Ki mod m) mod 26
m = keyword length; the key advances only on letters
Atbash
E(x) = 25 − x
Its own inverse
Chi-squared
χ² = Σ (O − E)² / E
O = letter counts, E = counts expected in English; lower is more English
Index of coincidence
IC = Σ n(n − 1) / N(N − 1)
≈ 0.067 for English, 0.038 for random letters; finds the Vigenère key length

Two Thousand Years of Shifting Letters

Suetonius wrote that Julius Caesar wrote private letters with each letter replaced by the one three places later. It worked because few of his enemies could read at all. Around 850 AD the Arab scholar al-Kindi described frequency analysis, counting how often each letter appears, and with it every simple substitution cipher fell.

The Vigenère cipher, described by Giovan Battista Bellaso in 1553 and later credited to Blaise de Vigenère, beat frequency analysis by changing the shift with every letter, and was called le chiffre indéchiffrable. Babbage broke it in the 1850s and Kasiski published the method in 1863: find the key length, then each column is just a Caesar cipher. William Friedman’s index of coincidence (1922), used by this tool, made finding the key length a matter of arithmetic.

About This Tool

This tool encrypts and decrypts four classic ciphers, keeps capitals and punctuation in place, and shows the substitution alphabet and letter frequencies next to normal English. Crack tries every Caesar shift and ranks them by chi-squared; for Vigenère it finds the key length with the index of coincidence, then solves each column as a Caesar cipher.

Cracking needs enough text: about 20 letters for Caesar and about 100 for Vigenère. Everything runs in your browser.

Related tools: ROT13 Cipher, Morse Code Translator, and Text Transformer.

Frequently Asked Questions

How does the Caesar cipher work?

Each letter is moved a fixed number of places along the alphabet, wrapping from Z back to A. With a shift of 3, A becomes D, B becomes E and X becomes A, so HELLO becomes KHOOR. To decrypt, shift back by the same amount. There are only 25 useful shifts, which is why it is so easy to break.

How can you crack a Caesar cipher without the key?

Try all 25 shifts and keep the one that looks most like English. This tool scores each attempt with a chi-squared test: it compares how often each letter appears with how often it appears in normal English (E about 12.7%, T 9.1%, Z 0.07%). The lowest score is almost always right once the message has 20 or more letters.

What is the Vigenère cipher?

A Caesar cipher whose shift changes letter by letter, following a keyword. With the key LEMON the first letter shifts by 11 (L), the second by 4 (E), and so on, repeating the keyword. Because one letter can encrypt to many different letters it resisted simple frequency analysis for three centuries, until Charles Babbage and Friedrich Kasiski broke it in the 1800s.

What are Atbash and A1Z26?

Atbash reverses the alphabet: A↔Z, B↔Y, C↔X. It is its own inverse, so encrypting twice gives back the original, and it appears in the Hebrew Bible. A1Z26 simply replaces each letter with its position: A=1, B=2 … Z=26, so HELLO is 8-5-12-12-15. Both are puzzle codes rather than real encryption.

Is any of this secure?

No. These are historical ciphers that a computer, or a patient person, can break in seconds — this page does it as you watch. Use them for puzzles, geocaches, escape rooms and teaching. For real secrets use modern encryption such as AES, which you would never write by hand.

How do I use the Caesar Cipher?

Simply type or paste your value and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.

Does it cost anything or need an account?

No. The tool is completely free, there is no account to create, and it keeps working offline after the page first loads.

Is anything I type uploaded?

No. The tool works entirely on your device, so the values you enter never leave your browser.

Common Use Cases

Puzzles and geocaches

Solve a cache clue such as “Wkh nhb lv xqghu wkh urfn” without knowing the shift: Crack ranks shift 3 first.

Escape rooms

Write a Vigenère clue with a keyword hidden elsewhere in the room, or a number code like 3-1-2-9-14 (CABIN) in A1Z26.

Teaching cryptography

Show students why a 26-key cipher falls to frequency analysis, then why Vigenère needs a second idea (the key length) before it falls too.

Checking homework

Confirm a hand-worked Vigenère exercise: ATTACKATDAWN with key LEMON is LXFOPVEFRNHR.

Last updated: