T

Text Machine

Powerful text tools, in your browser

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.

Cipher settings

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.

Plain text
Cipher text

Enter text above to see the result here.

Trifid cube

Layer 1

1

2

3

1

A
B
C

2

D
E
F

3

G
H
I

Layer 2

1

2

3

1

J
K
L

2

M
N
O

3

P
Q
R

Layer 3

1

2

3

1

S
T
U

2

V
W
X

3

Y
Z
+

How to use Trifid Cipher

  1. 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. 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. 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. 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. 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?
The Trifid cipher is a classical cipher invented by Félix Délastelle and published in 1902. It is the three-dimensional version of his Bifid cipher: each letter is turned into three coordinates — a layer, a row, and a column — on a 3x3x3 cube of 27 symbols, and those coordinates are interleaved across a block before being read back as letters. This makes every output letter depend on three input letters.
How does the Trifid cipher work?
Each letter is replaced by its layer, row, and column digit from the cube. For a block of letters, all the layer digits are written on one line, all the row digits on the next, and all the column digits on the third; that combined run is then read across in groups of three, and each triple is looked up as a layer, row, and column to give a cipher letter. Decoding reverses the process by splitting the run back into three equal parts.
Who invented the Trifid cipher?
The Trifid cipher was created by the French cryptographer Félix-Marie Délastelle and published in his 1902 treatise on cryptography, alongside his related Bifid, four-square, and two-square ciphers. Trifid was his three-dimensional extension of Bifid, showing that fractionating each letter into three coordinates instead of two spreads its influence even further and strengthens the cipher against frequency analysis.
What is the difference between the Trifid and Bifid ciphers?
Both fractionate letters into coordinates and interleave them across a block, but Bifid uses a flat 5x5 or 6x6 square and two coordinates per letter, while Trifid uses a 3x3x3 cube of 27 symbols and three coordinates. Because Trifid mixes three digit streams instead of two, each output letter depends on three input letters rather than two, giving more diffusion. Trifid is the stronger, more advanced of the two.
What is the period in a Trifid cipher?
The period is the block size. The message is split into blocks of that many letters, and the layer-row-column interleaving happens within each block on its own. A short period limits how far each letter's effect spreads, while a long period spreads it further. A period of 0 means the whole message is one block. The sender and receiver must use the same period to communicate.
What is the 27th symbol in the cube?
A 3x3x3 cube has 27 cells but the alphabet has only 26 letters, so a 27th symbol is added to fill the last cell. This tool uses the plus sign, a common convention. Because it is rarely typed, ordinary punctuation in your text is dropped rather than being mistaken for a letter. The plus sign can appear in encoded output, where it simply marks that last cube cell.
What does the keyword do?
A keyword scrambles the cube. Its unique symbols are written into the cube first, in order and without repeats, and the rest of the alphabet follows. This changes every coordinate, so both sides must use the same keyword as well as the same period. Leaving the keyword blank uses the plain alphabetical cube. The live cube highlights the keyword cells so you can see how the mixing works.
Can you show a worked Trifid example?
Using the plain cube over the whole word, HELLO fractionates to layers 1 1 2 2 2, rows 3 2 1 1 2, and columns 2 2 3 3 3. Reading those as one run, 1 1 2 2 2 3 2 1 1 2 2 2 3 3 3, and grouping the digits in threes gives 112, 223, 211, 222, 333, which look up as B, O, J, N and +. So HELLO encodes to BOJN+. With a period of 3 the same word becomes BVOMR instead.
How do you decode a Trifid cipher?
Read off the three coordinates of every cipher letter in order to rebuild the combined run of digits, then split it into three equal parts: the first part are the plaintext layer digits, the second the row digits, and the third the column digits. Recombining each letter's layer, row, and column recovers the text. In this tool, choose Decode and set the same keyword and period that were used to encode.
How is Trifid related to the Polybius square?
The Polybius square is the two-dimensional ancestor of both Bifid and Trifid: it gives each letter a pair of coordinates on a flat grid. Bifid mixes those two-coordinate addresses across a block, and Trifid extends the idea into three dimensions with a cube, so each letter has a three-coordinate address. If you understand the Polybius square and Bifid, Trifid is the logical next step up.
How secure is the Trifid cipher?
Not secure by modern standards. Although its three-way fractionation defeats simple frequency analysis, cryptanalysts have reliable methods for breaking Trifid, especially with a short or known period and enough cipher text, and a keyword only slows that down. Its value today is educational. For protecting real information, use a modern algorithm such as AES and keep Trifid for puzzles and learning.
Is my text uploaded to a server?
No. All encoding and decoding happens entirely in your browser, so your text is never uploaded, logged, or stored. Even a share link keeps your text, keyword, and period in the part of the URL after the hash, which browsers never send to a server, so your message stays private until you choose to share the link.

Related tools

Keep going with these handy tools

Bifid Cipher

Polybius Square

Four-Square Cipher

Two-Square Cipher

Caesar Cipher

Vigenère Cipher