Chaocipher
Encode and decode the Chaocipher, the dynamic-substitution cipher invented by John F. Byrne in 1918 and kept secret until 2010. Two alphabets sit on conceptual disks and rearrange after every letter, so each letter is enciphered under a freshly shuffled alphabet. Edit both starting alphabets, switch between encode and decode, and watch the disks turn. Everything runs in your browser.
Left disk (cipher)
Right disk (plain)
Each disk must contain every letter A to Z exactly once. The two starting arrangements are the key, so the sender and receiver must use the same pair. The defaults are Byrne's classic Exhibit 1 alphabets.
Enter text above to see the Chaocipher result here.
How to use Chaocipher
- 1
Choose encode or decode
Pick Encode to turn plaintext into Chaocipher ciphertext, or Decode to recover the plaintext from ciphertext. The same starting alphabets are used either way.
- 2
Set the two starting alphabets
Enter the left disk and right disk alphabets, each a rearrangement of all 26 letters. They are the key, so use the same pair as your correspondent, or keep the classic Exhibit 1 defaults to reproduce Byrne's example.
- 3
Type or paste your text
Enter the message you want to convert. The cipher runs automatically as you type, finding each letter on one disk and reading the result from the other, then permuting both disks.
- 4
Read, copy, and share
Read the result, then copy it, download it as a text file, or share a link that reopens the tool with your exact alphabets, direction, and text. Everything stays in your browser.
Understanding the Chaocipher
What is the Chaocipher?
The Chaocipher is a polyalphabetic substitution cipher invented by the Irish-American businessman John F. Byrne in 1918. Its defining idea is that the cipher rearranges itself as it runs: two alphabets sit on a pair of conceptual disks, and after every single letter both alphabets are permuted. Because each letter is enciphered under a freshly shuffled alphabet, the same plaintext letter almost never produces the same ciphertext letter twice, which erases the letter-frequency pattern that breaks simpler ciphers.
Byrne was convinced his method was both unbreakable and simple enough to fit in a shirt pocket. He described it in his 1953 autobiography Silent Years and offered a cash reward to anyone who could solve his challenge messages, but he never revealed how it worked. The algorithm stayed a mystery for more than ninety years. Only in 2010, after Byrne's family donated his papers and a working model to the National Cryptologic Museum, did Moshe Rubin reconstruct and publish the exact method.
How the Chaocipher works
The key is a pair of 26-letter alphabets, one for each disk. The left disk holds the cipher alphabet and the right disk holds the plain alphabet. To encipher a letter, find it in the right disk and read off the letter at the very same position in the left disk. To decipher, you do the reverse: find the ciphertext letter in the left disk and read the plaintext from the same position in the right disk. The two disks must start in the same arrangement for the sender and the receiver.
What turns this from a plain substitution into the Chaocipher is what happens next. After each letter is enciphered, both disks are permuted by a fixed set of moves, so the alphabets that encipher the second letter are no longer the alphabets that enciphered the first. This self-modifying behaviour is why Byrne called it chaotic. Only the 26 letters are processed; spaces, punctuation, and other characters pass through untouched and do not turn the disks, and letter case is preserved.
Worked example
Use the classic Exhibit 1 alphabets from Byrne's own papers: the left disk HXUCZVAMDSLKPEFJRIGTWOBNYQ and the right disk PTLNBQDEOYSFAVZKGJRIHWXUMC. Encipher the message WELLDONEISBETTERTHANWELLSAID. For the first letter, find W in the right disk and read the letter that lines up in the left disk, which is O. Then both disks permute, and the next letter E is enciphered under the new arrangement. Continuing through the whole message gives the ciphertext OAHQHCNYNXTSZJRRHJBYHQKSOUJY.
To decipher, start the two disks from the same Exhibit 1 arrangement and run the mirror process: find each ciphertext letter in the left disk and read the plaintext from the same position in the right disk, permuting both disks after every letter. Feeding in OAHQHCNYNXTSZJRRHJBYHQKSOUJY returns WELLDONEISBETTERTHANWELLSAID. Notice that the repeated letters in WELL do not repeat in the ciphertext, because the disks have moved on by the time the cipher reaches them.
How the two disks permute
The permutation uses two reference points on each disk: the zenith, the first position, and the nadir, the fourteenth position. For the left disk, first rotate it so the letter just enciphered moves to the zenith. Then take out the letter now standing one place past the zenith, slide the block of letters from there down to the nadir one place toward the zenith, and drop the extracted letter back into the empty nadir slot.
The right disk moves in a similar but slightly shifted way. First rotate it so the letter one place to the right of the plaintext letter reaches the zenith. Then take out the letter standing two places past the zenith, slide the block from there down to the nadir one place toward the zenith, and reinsert the extracted letter at the nadir. These small, fixed rearrangements are applied after every letter, and because they are deterministic the receiver reproduces exactly the same disk movements when decrypting.
The Byrne mystery
For decades the Chaocipher was one of cryptography's most tantalising puzzles. Byrne was a close friend of James Joyce and appears in Joyce's writing, which only added to the intrigue when, in Silent Years, he devoted a chapter to a cipher he claimed governments would pay a fortune for. He printed challenge texts, including the famous Exhibit 1 with its plaintext and ciphertext side by side, and dared the world to recover his method from them. No one publicly succeeded in his lifetime.
The puzzle was finally settled through the cooperation of Byrne's son and the historian community. In May 2010 the family placed Byrne's Chaocipher materials, including the physical model, with the National Cryptologic Museum, and shortly afterwards Moshe Rubin worked out and published the algorithm in his paper Chaocipher Revealed. The reveal showed that Byrne's pocket-sized device really did implement the dynamic two-disk scheme described here.
How strong is the Chaocipher?
For a hand cipher of its era the Chaocipher is genuinely clever. Because both alphabets change after every letter, a straightforward frequency count of the ciphertext reveals almost nothing, and a short message betrays very little about the starting alphabets. That dynamic behaviour was decades ahead of the fixed-tableau ciphers like Vigenère that were standard when Byrne devised it.
It is not secure by modern standards, however. The permutation rules are fixed and public, so the only secret is the pair of starting alphabets, and a determined analyst with enough known plaintext, exactly what Byrne supplied in his exhibits, can reconstruct those alphabets and recover the system. The Chaocipher resisted casual solvers for a long time mainly because the method itself was kept secret, not because it could withstand sustained modern cryptanalysis.
Is the Chaocipher secure?
No. The Chaocipher is a fascinating piece of cryptographic history and a wonderful teaching example of a self-modifying cipher, but it offers no real protection against modern analysis. Its security depended largely on keeping the algorithm hidden, and once the method is known the starting alphabets can be recovered from enough enciphered text.
Today the Chaocipher is enjoyed for its story and its mechanism rather than for hiding anything. It is a favourite in puzzles, escape rooms, and capture-the-flag challenges, and it rewards anyone curious about how cryptography evolved from fixed substitutions toward the dynamic systems that followed. For protecting real information you should rely on modern, well-tested algorithms such as AES instead.
Frequently asked questions
What is the Chaocipher?
How does the Chaocipher work?
What is the key for the Chaocipher?
Can you show a Chaocipher example?
How do the disks change after each letter?
Why is the Chaocipher famous?
Who solved the Chaocipher and when?
How is the Chaocipher different from the Vigenère cipher?
Does the cipher change spaces and punctuation?
How do I decode a Chaocipher message?
Is the Chaocipher secure?
Is my text uploaded to a server?
Related tools
Keep going with these handy tools