T

Text Machine

Powerful text tools, in your browser

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.

Starting alphabets (the key)

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.

Plaintext
Ciphertext

Enter text above to see the Chaocipher result here.

How to use Chaocipher

  1. 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. 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. 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. 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?
The Chaocipher is a dynamic-substitution cipher invented by John F. Byrne in 1918. It uses two 26-letter alphabets on a pair of conceptual disks, and after every letter both alphabets are permuted, so each letter is enciphered under a freshly shuffled alphabet. Byrne kept the method secret, and it was only published in 2010 by Moshe Rubin.
How does the Chaocipher work?
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 the letter at the same position in the left disk. Then both disks are permuted by a fixed set of moves. To decipher, find the ciphertext letter in the left disk and read the plaintext from the same position in the right disk, permuting the disks the same way.
What is the key for the Chaocipher?
The key is the pair of starting alphabets, one for each disk. Each must contain every letter A to Z exactly once. The sender and receiver have to begin from the same two arrangements. This tool defaults to Byrne's classic Exhibit 1 alphabets, but you can replace either disk with your own.
Can you show a Chaocipher example?
Using Byrne's Exhibit 1 alphabets, the left disk HXUCZVAMDSLKPEFJRIGTWOBNYQ and the right disk PTLNBQDEOYSFAVZKGJRIHWXUMC, the plaintext WELLDONEISBETTERTHANWELLSAID enciphers to OAHQHCNYNXTSZJRRHJBYHQKSOUJY. Decrypting that ciphertext from the same starting alphabets returns the original message.
How do the disks change after each letter?
Each disk has a zenith at position one and a nadir at position fourteen. The left disk rotates the enciphered letter to the zenith, then extracts the letter one place past the zenith, shifts the block down to the nadir toward the zenith, and reinserts at the nadir. The right disk rotates the letter just right of the plaintext letter to the zenith, then extracts the letter two places past the zenith and reinserts it at the nadir in the same way.
Why is the Chaocipher famous?
Byrne claimed in his 1953 book Silent Years that his pocket-sized cipher was unbreakable, offered a reward to solve his challenge messages, but never revealed the method. It stayed unsolved for over ninety years, which made it one of cryptography's best-known mysteries until the algorithm was finally published in 2010.
Who solved the Chaocipher and when?
The method became public in 2010, after Byrne's family donated his Chaocipher papers and a physical model to the National Cryptologic Museum. The cryptographer Moshe Rubin then reconstructed and published the exact algorithm in his paper Chaocipher Revealed, ending decades of speculation about how the device worked.
How is the Chaocipher different from the Vigenère cipher?
A Vigenère cipher uses a fixed table of alphabets and a repeating keyword, so the alphabets never change during the message. The Chaocipher instead permutes both of its alphabets after every letter, so the substitution is never reused. That self-modifying behaviour makes it much harder to attack with simple frequency analysis than a fixed-tableau cipher.
Does the cipher change spaces and punctuation?
No. Only the 26 letters are processed and used to turn the disks. Spaces, punctuation, digits, and emoji pass through unchanged and do not advance the disks, so the result keeps the shape of your original text. Letter case is preserved as well.
How do I decode a Chaocipher message?
Switch the tool to Decode, enter the same two starting alphabets the message was encrypted with, and paste the ciphertext. The tool finds each ciphertext letter in the left disk, reads the plaintext from the right disk, and permutes both disks the same way, recovering your message.
Is the Chaocipher secure?
No. The Chaocipher is a remarkable historical cipher, but it offers no real security against modern analysis. The permutation rules are public, so the only secret is the pair of starting alphabets, and they can be recovered from enough known plaintext. Use a modern algorithm such as AES to protect real information.
Is my text uploaded to a server?
No. All encoding and decoding happen entirely in your browser, so your text and alphabets are never uploaded, logged, or stored. Even a share link keeps your data in the part of the URL after the hash, which browsers never send to a server, so it stays private until you choose to share it.

Related tools

Keep going with these handy tools

Vigenère Cipher

Beaufort Cipher

Gronsfeld Cipher

Autokey Cipher

Running Key Cipher

Porta Cipher