Trifid Cipher
Encode and decode the Trifid cipher, the three-dimensional sibling of Bifid: each letter is fractionated into three coordinates on a 3x3x3 cube, the coordinates of a block are mixed, and every output letter ends up depending on three inputs. Set the period, add an optional keyword, follow the live fractionation, and copy, download, or share the result. Everything runs in your browser.
Period
Keyword
The period is the block size: the text is split into blocks of this many letters and the coordinates are mixed within each block. Both sides must use the same period.
Enter text above to see the result here.
Trifid cube
Layer 1
1
2
3
1
2
3
Layer 2
1
2
3
1
2
3
Layer 3
1
2
3
1
2
3
How to use Trifid Cipher
- 1
Choose encode or decode
Pick Encode to turn plain text into Trifid cipher text, or Decode to turn cipher text back into plain text.
- 2
Set the period and keyword
Choose the block size the cipher works in; a period of 0 treats the whole message as one block. Leave the keyword blank for the plain cube or enter one to mix it. Both sides must use the same settings.
- 3
Type or paste your text
Enter your message and it is converted as you type. The fractionation panel shows each block's letters over their layer, row, and column digits.
- 4
Read the cube
Open the Trifid cube to see all three layers, with the coordinate of every symbol and any keyword cells highlighted.
- 5
Copy, download, or share
Copy the result, download it as a text file, or share a link that reopens the tool with your exact text, keyword, and period ready to go.
Understanding the Trifid Cipher
What is the Trifid cipher?
The Trifid cipher is a classical cipher invented by the French cryptographer Félix-Marie Délastelle and published in 1902. It is the three-dimensional extension of his Bifid cipher: where Bifid turns each letter into two coordinates read off a flat square, Trifid turns each letter into three coordinates — a layer, a row, and a column — read off a 3x3x3 cube of 27 symbols. Those coordinates are then shuffled together before being read back as letters, combining substitution with transposition in a single scheme.
Adding a third coordinate is what makes Trifid stronger than Bifid. Because three separate digit streams are interleaved before they are regrouped, each letter of the output depends on three different letters of the input rather than two. That wider spreading of information — diffusion — hides letter-frequency patterns even more thoroughly, which is why Trifid is a favourite advanced example in cryptography courses and puzzle collections.
The 3x3x3 cube and its 27th symbol
Trifid needs 27 cells, one for each symbol, arranged as three 3x3 layers stacked into a cube. The 26 letters of the alphabet fill 26 of those cells, leaving one spare, so a 27th symbol is added. This tool uses the plus sign, the common convention; because it is rarely typed, ordinary punctuation in your message is simply dropped rather than being treated as a letter. Every symbol therefore has a unique address made of three numbers from 1 to 3: which layer it sits in, which row, and which column.
You can also mix the cube with a keyword. The keyword's unique symbols are written into the cube first, in order and without repeats, and the rest of the alphabet follows — exactly the way a keyed Polybius or Playfair square is built, just in three dimensions. The live cube above highlights the keyword cells so you can see the mixing. Changing the keyword changes every coordinate, so the keyword is part of the secret and both sides must use the same one.
How the Trifid cipher works
Encoding happens in three steps. First, fractionation: each letter is looked up in the cube and replaced by its three coordinates — layer, row, and column. Second, the coordinates of a block of letters are written out as three rows, with all the layer digits on the first line, all the row digits on the second, and all the column digits on the third. Third, that combined run of digits is read straight across, taken three at a time, and each triple is looked up in the cube as a layer, row, and column to produce a cipher letter.
Writing the layers first, then the rows, then the columns is the heart of the method: it interleaves digits that came from different letters. The tool above shows this live. As you type, the fractionation panel lays out each block's letters over their layer, row, and column digits, exactly the way you would work the cipher by hand on paper, so you can watch a single input letter's three digits drift apart into three separate output letters.
The period, or block size
The period is the block size Trifid works in. The text is divided into blocks of that many letters, and the layer-row-column interleaving is carried out within each block independently. A short period limits how far each letter's influence can spread; a long period spreads it across more of the message. Délastelle's classic worked examples use a period of five, and the sender and receiver must agree on the same value.
Setting the period to 0 means no period at all: the entire message is treated as a single block, which is the scheme Délastelle originally described and which gives the strongest diffusion. The trade-off is that a long, periodless message is harder to work by hand. Try changing the period above and watch how the cipher text changes even though the cube and the text stay the same — that sensitivity is the whole point of the block structure.
A worked Trifid example
Take the word HELLO with the plain cube and a period covering the whole word. First fractionate each letter into its layer, row, and column: H is 1,3,2; E is 1,2,2; L is 2,1,3; the second L is 2,1,3 again; and O is 2,2,3. Writing the layers on one line gives 1 1 2 2 2, the rows on the next give 3 2 1 1 2, and the columns on the third give 2 2 3 3 3.
Now read the three lines straight across as a single run — 1 1 2 2 2 3 2 1 1 2 2 2 3 3 3 — and take the digits three at a time: 112, 223, 211, 222, 333. Looking each triple up in the cube as a layer, row, and column gives B, O, J, N and +, so HELLO encodes to BOJN+. With a period of 3 the same word instead becomes BVOMR, because the blocks break in a different place and the mixing changes.
Decoding a Trifid cipher
Decoding runs the steps in reverse. For each block, you read off the three coordinates of every cipher letter in order, which reproduces the combined run of digits. Splitting that run into three equal parts gives the original layer digits in the first part, the row digits in the second, and the column digits in the third; pairing each letter's layer with its matching row and column rebuilds the plaintext. The tool does all of this for you when you choose Decode.
To decode correctly you must use the same settings that were used to encode: the same keyword and the same period. Get either of them wrong and the digits split in the wrong place, producing garbled text — which is exactly the property that makes the cipher useful. Because only the 26 letters and the plus sign live in the cube, any other characters in the original message were dropped during encoding and will not reappear.
Trifid versus Bifid, and its security
Trifid and Bifid are siblings: both fractionate letters into coordinates and interleave them across a block, and both were devised by Délastelle. The difference is the dimension. Bifid uses a flat square and two coordinates per letter; Trifid uses a cube and three coordinates, so each output letter depends on three inputs instead of two, giving more diffusion. Trifid is the natural next step for anyone who has understood Bifid and the Polybius square it is built on.
By modern standards Trifid is not secure. Although its three-way fractionation defeats simple frequency analysis, cryptanalysts have established methods for breaking it, especially when the period is short or known and enough cipher text is available, and a keyword only raises the bar a little. Its real value today is educational: it is a vivid, hands-on way to see how extra fractionation strengthens a cipher. For protecting real information, always use a modern, peer-reviewed algorithm such as AES, and keep Trifid for learning, puzzles, and capture-the-flag challenges.
Frequently asked questions
What is the Trifid cipher?
How does the Trifid cipher work?
Who invented the Trifid cipher?
What is the difference between the Trifid and Bifid ciphers?
What is the period in a Trifid cipher?
What is the 27th symbol in the cube?
What does the keyword do?
Can you show a worked Trifid example?
How do you decode a Trifid cipher?
How is Trifid related to the Polybius square?
How secure is the Trifid cipher?
Is my text uploaded to a server?
Related tools
Keep going with these handy tools