The Black Chamber RU

Tools · Classical ciphers

Substitution cipher

Keyword or custom-alphabet substitution: encode, decode and crack letter by letter.

Runs in your browser. Your text goes nowhere.

How to use it

The key of a simple substitution cipher is a whole alphabet: under every letter sits the sign that replaces it. There are three ways to set it.

  • With a keyword. The keyword's letters, without repeats, come first, followed by the rest of the alphabet in order. “Black chamber” gives BLACKHMERDFGIJNOPQSTUVWXYZ.
  • At random. “Random key” shuffles the alphabet with your browser's random number generator.
  • By hand. Edit the key line as a whole, or type a letter into any box of the pairs. If that letter was already in another box, the two swap places, so the key stays valid: every letter exactly once.

“Encrypt” replaces the letters of the text using the key, “Decrypt” goes back. Case is kept; spaces and punctuation are untouched. Pairs that occur in the text are highlighted.

Without the key

Paste the ciphertext, choose “Decrypt” and press “Guess by frequency”. The tool puts the commonest letter of the language (E in English) in place of the commonest sign, the second (T) in place of the second, and so on. That is al-Kindi's first guess. It usually gets only a few letters right, but from there it is easy to fix: type into a box the letter you think a sign stands for and watch the decryption change. Look for short words, common endings and doubled letters. A step-by-step walkthrough with a practice board is in the substitution lesson, and the frequency analysis tool shows the sign counts in detail.

How safe is it?

Substitution has 26! ≈ 4 · 1026 keys for English and 33! ≈ 8.7 · 1036 for Russian, far too many to try. But the cipher keeps letter frequencies and the shapes of words, so a text of a few hundred letters can be cracked by hand in an hour. It's no good for real secrets, but perfect for puzzles and games.

FAQ

How is substitution different from the Caesar cipher?

In Caesar the cipher alphabet is the same alphabet shifted as a whole, so there are only 25 keys. In substitution the alphabet is shuffled any way at all. Caesar and Atbash are special cases of it.

Is this the same as a newspaper cryptogram?

Yes. The cryptograms in puzzle pages are simple substitutions, usually with a random key.

Is it safe to paste my text here?

Yes. Everything runs in your browser and nothing is sent to a server.