Tooleux

Classical Cipher Toolkit - 9 Historical Ciphers Online

Classical (3)

Encode and decode nine classical ciphers. Atbash, Vigenere, Beaufort, Playfair, Rail Fence, Bacon, A1Z26, Polybius, Affine.

Runs in your browser. Nothing leaves your device.
Encode and decode 9 classical ciphers: Atbash, Vigenere, Beaufort, Playfair, Rail Fence, Bacon, A1Z26, Polybius, Affine. Runs in your browser. Read more Show less

What are classical ciphers?

Classical ciphers are the pre-computer encryption methods: substitution, transposition, and simple arithmetic on letters. They are not secure against modern cryptanalysis - a laptop breaks them in milliseconds - but they are useful for puzzles, teaching, escape rooms, and understanding how modern cryptography evolved.

This tool implements nine classical ciphers in one page. Each has its own history, its own weaknesses, and its own quirks. All are historically accurate; none should be used to protect anything.

How to use

Pick a cipher from the dropdown. The relevant parameters appear below it. Type or paste text, choose encode or decode, and the result updates live.

For most ciphers, encode and decode are different operations. Two of them - Atbash and Beaufort - are self-inverse: encoding and decoding produce the same result, and the tool will show a note when you select them.

The nine ciphers

  • Atbash - A becomes Z, B becomes Y, and so on. Used in the Hebrew Bible. Self-inverse.
  • Vigenere - A repeating-key polyalphabetic cipher. For 300 years it was considered unbreakable.
  • Beaufort - A variant of Vigenere where subtraction goes the other way. Self-inverse.
  • Playfair - A digraph cipher using a 5x5 grid. Used by British forces in WWI and WWII. Combines I and J.
  • Rail Fence - A transposition cipher that writes text in a zigzag and reads it off in rows.
  • Bacon - Each letter becomes five a/b bits. Two variants: 24-letter (combines I/J and U/V) and 26-letter.
  • A1Z26 - The simplest cipher: A is 1, B is 2, ..., Z is 26.
  • Polybius - A 5x5 or 6x6 grid. Each letter becomes a row/column pair.
  • Affine - A linear function E(x) = (a*x + b) mod 26. Reversible when a is coprime with 26.

Known quirks

Classical ciphers have documented limitations. These are not bugs:

  • Playfair combines I and J. The grid has 25 letters, not 26. An input J is treated as I. X is inserted to pad odd-length messages and to break double letters.
  • Playfair round-trip is imperfect. Encoding then decoding the same text may add an X that was not in the original. That X was the padding. There is no way to distinguish a real X from a padding X after decoding.
  • Polybius loses word boundaries. Each letter becomes a two-digit code. Spaces between codes are letter separators, not word separators. Decoding produces a continuous letter string.
  • Bacon preserves spaces between words so decode can split by space. Non-letter punctuation is dropped.
  • Rail Fence and Playfair preserve the positions of non-letter characters (spaces, punctuation). Letter case is preserved. The cipher algorithms operate on the letter sequence only.
  • A1Z26 preserves spaces and uses a configurable separator between letter codes within a word. Default is a hyphen.

FAQ

Are these ciphers secure?

No. Every classical cipher on this page can be broken by a modern computer in less than a second. Use AES-GCM or ChaCha20-Poly1305 for real encryption. These ciphers are for puzzles, teaching, and historical recreation.

Why does Playfair change my text length?

Playfair operates on letter pairs. Odd-length input is padded with X. Double letters are broken with an X between them. Both additions increase the length. The decoded output may contain X characters that were not in your original.

Why does Polybius decoding lose the spaces in my text?

Polybius converts each letter to a two-digit number. The separator between letter codes is a space. If word boundaries were also preserved as spaces, decoding could not tell them apart from letter separators. So word boundaries are lost. The decoded text is a continuous letter string.

What is the difference between Bacon 24 and Bacon 26?

The 24-letter variant combines I with J and U with V, giving 24 codes. The 26-letter variant has a code for every letter. Historically, Bacon used the 24-letter variant. Modern usage often prefers the 26-letter variant for compatibility with English text.

What does self-inverse mean?

For Atbash and Beaufort, applying the cipher twice returns the original text. So encoding and decoding are the same operation. The tool shows a note when you select one of these. The direction dropdown is ignored; the output is the same either way.

Is my text sent anywhere?

No. All ciphers run entirely in your browser.

Command line equivalent
# Python (ciphey - automated classical cipher solver)
pip install ciphey
ciphey -t "LXFOPVEFRNHR"

# Python (pycipher - classical ciphers)
pip install pycipher
python3 -c "from pycipher import Vigenere; print(Vigenere('LEMON').encipher('ATTACKATDAWN'))"

# OpenSSL (for reference; classical ciphers not supported)
openssl enc -list | grep -i caesar

# Ruby (baconian gem)
gem install baconian
ruby -rbaconian -e 'puts Baconian.encode("hello")'

# Node.js
npm i ciphers
node -e "const {vigenere}=require('ciphers');console.log(vigenere.encode('ATTACKATDAWN','LEMON'))"
Loads a test value into the form
Input
Output