The Vigenère cipher uses a repeating key to shift each message letter. A key letter A means a shift of 0, B means 1, and Z means 25. Because the shift changes with the key, the same message letter can turn into different letters.

Keep the key aligned

  • Use an A–Z key of 1 to 64 letters, and check the normalized key shown by the tool.
  • Repeat the key over letters only. Spaces, punctuation, and digits do not take a key letter.
  • Encode with C = (P + K) mod 26. Decode with P = (C − K) mod 26.
  • Each new conversion starts at the beginning of the key.

Line up the key LEMON

InputATTACKATDAWN
SettingsKey LEMON; A = 0
Expected resultLXFOPVEFRNHR
Try this method
RowLetters
PlaintextATTACKATDAWN
Repeated keyLEMONLEMONLE
CiphertextLXFOPVEFRNHR

For the first letter, A = 0 and the key’s L = 11, giving L. Next, T = 19 plus E = 4 gives 23, or X. The third letter adds T = 19 and M = 12 to make 31, which wraps around to 5, or F.

Punctuation does not shift the key

With the same key, ATTACK AT DAWN becomes LXFOPV EF RNHR. The spaces stay visible, but they do not use key letters or restart the key. Continue the sequence across word boundaries.

Try one yourself

Encode MEET ME using key MAP. Write the key only beneath the six letters.

Keep exploring

Work through Vigenère with LEMONPrint Vigenère practice with keysClassical Beaufort toolHow text conversion and preparation work