Encode and decode text using the Vigenère cipher with a custom key. A classic polyalphabetic substitution cipher for secure message encryption.
The Vigenère cipher is a method of encrypting text using a series of Caesar ciphers based on the letters of a keyword. Invented by Giovan Battista Bellaso in the 16th century but misattributed to Blaise de Vigenère, it was considered unbreakable for centuries and earned the name 'le chiffre indéchiffrable' (the indecipherable cipher). Unlike simple substitution ciphers, the Vigenère cipher is polyalphabetic, meaning each letter can be encrypted differently depending on its position and the corresponding letter in the key.
To encode a message, you align your plaintext with a repeating key. For each letter in the plaintext, you shift it forward in the alphabet by the number of positions indicated by the corresponding key letter (A=0, B=1, C=2, etc.). For example, with plaintext 'HELLO' and key 'KEY', H shifts by K (10 positions) to become R, E shifts by E (4 positions) to become I, L shifts by Y (24 positions) to become J, and so on. Numbers, spaces, and punctuation remain unchanged.
To decode an encrypted message, you use the same key but shift letters backward instead of forward. This calculator handles both encoding and decoding automatically. Simply enter your text, provide a key (any sequence of letters), choose the mode, and get your result instantly. The cipher preserves letter case and leaves non-alphabetic characters untouched.
Plaintext: 'HELLO WORLD', Key: 'KEY'. Encoding: H+K=R, E+E=I, L+Y=J, L+K=V, O+E=S, W+Y=U, O+K=Y, R+E=V, L+Y=J, D+K=N. Result: 'RIJVS UYVJN'. Decoding 'RIJVS UYVJN' with key 'KEY' returns 'HELLO WORLD'.