1001Ferramentas
🗝️ Security

Keyword Cipher

Build the cipher alphabet from the keyword you choose, followed by the remaining letters. Enciphers and deciphers, and shows the generated alphabet next to the plain one.

Alphabet in use

    

The keyword that scrambles the alphabet

The keyword cipher solves a practical problem with simple substitution: memorising a permutation of 26 letters is impossible, memorising a word is trivial. The cipher alphabet starts with the letters of the key, with repeats dropped, and continues with the remaining letters in normal order. The key SECRET produces S, E, C, R, T and then A, B, D, F and onwards.

Type the key and the text and the page shows both alphabets aligned, plain on top and cipher below — looking at that pair is what makes the cipher click. The reverse direction deciphers using the same pair read the other way. Accents are stripped before enciphering: without that, an accented character would pass through untouched and hand part of the content to anyone trying to break it.

Like every monoalphabetic substitution, it falls to frequency analysis. Each plaintext letter always becomes the same ciphertext letter, so the language's distribution survives: the most common letter in the ciphertext is almost always E or A in disguise. With a paragraph of reasonable size, breaking it takes minutes — the value of the cipher today is educational and recreational.

Frequently asked questions

Can the key contain repeated letters?
It can, and usually does: repeats are simply ignored from the second occurrence onwards. SECRET has two E letters, and the cipher alphabet uses only the first — which is why it begins S, E, C, R, T rather than with all six letters of the word.
Where should the key sit in the alphabet?
In this version, at the beginning, which is the most common form. Variants insert the key starting at an agreed position, which slightly enlarges the key space — but it does not change the underlying problem, which is letter frequency surviving the substitution.
How does it differ from a Caesar cipher?
Caesar is a special case of substitution where the cipher alphabet is the plain one shifted, which gives only 25 possible keys. With a keyword, the alphabet can be any permutation and the space becomes astronomical. Frequency analysis gives away both all the same.

Related Tools