Trifid Cipher Encoder & Decoder
The Trifid cipher is a classical three-dimensional substitution-transposition cipher invented by Felix Delastelle in 1902. Each letter is mapped to a coordinate in a 3x3x3 cube (layer, row, column). The coordinates of a block of letters are then read in transposed order to produce ciphertext. Enter your message and keyword below to encode or decode, and see a full step-by-step coordinate breakdown.
FELIX, Period 5, plaintext HOWDY →
Coordinates H=132, O=213, W=322, D=121, Y=333 → grouped → transposed → ciphertext output shown below the cube.
Frequently Asked Questions
What is the Trifid cipher?
The Trifid cipher is a classical substitution-transposition cipher invented by Felix Delastelle in 1902. It extends the Polybius square into three dimensions: each letter is encoded as a coordinate in a 3x3x3 cube (layer, row, column). The coordinates of all letters are written out, grouped into blocks of a chosen length called the period, and then read column by column to produce new triplets. Each new triplet maps back to a letter in the cube. This layering of substitution and transposition makes it much stronger than simple substitution ciphers.
How do I decode a Trifid cipher message?
To decode, reverse the encoding process. Convert each ciphertext letter back to its cube coordinate triplet. Group those triplets in the same period blocks used during encoding. For each block, read the digits row by row instead of column by column, which gives you the original layer-row-column triplets. Look each triplet up in the cube to recover the original letters. This tool does all of that automatically and shows you every step.
What is the period in the Trifid cipher?
The period (also called group size) is the number of letters processed together in each block. A period of 5 means the three-digit coordinates of every 5 letters are grouped together and then re-read column by column. Larger periods increase diffusion, making frequency analysis harder. A period equal to the full message length is the strongest setting.
What is a keyword in the Trifid cipher?
A keyword scrambles the order of letters in the 3x3x3 cube. The keyword letters are placed first (with duplicates removed), and the remaining letters of the alphabet fill the rest of the cube. This means only someone who knows the keyword can correctly arrange the cube and decode the message.
Is the Trifid cipher secure?
The Trifid cipher is stronger than simple substitution ciphers, but it is not cryptographically secure by modern standards. With enough ciphertext (typically 200 or more letters) and statistical techniques, it can be broken. It is used today for educational purposes and cipher puzzle competitions such as ACA cryptogram challenges.
How is the Trifid cipher different from the Bifid cipher?
The Bifid cipher, also invented by Felix Delastelle, uses a 5x5 Polybius square (25 letters) instead of a 3x3x3 cube. Each letter encodes to a row and column (2 digits), making it a two-dimensional cipher. The Trifid extends this to three dimensions using a 3x3x3 cube (27 positions), giving each letter a triplet of coordinates (layer, row, column). The extra dimension increases the number of possible coordinate patterns and creates stronger diffusion, but the decryption process is analogous — reverse the transposition of coordinate rows.
What is a Polybius square and how is it related?
A Polybius square is a 5x5 grid where each letter is encoded as a (row, column) number pair. The classical version puts the alphabet (merging I and J) into a 5x5 grid numbered 1-5 on each axis. The word HELLO encodes as (2,3)(1,5)(3,1)(3,1)(3,4). The Bifid and Trifid ciphers extend this principle to two and three Polybius-like dimensions respectively, then interleave the coordinate digits across all letters in a block — which is what makes them stronger than a simple substitution cipher.
What is the 27th character in the Trifid cube?
The standard 26-letter Latin alphabet fills 26 of the 27 positions in the 3x3x3 cube. The 27th position is typically filled with a special character such as a period (.), the plus sign (+), or the letter/number combination that completes the cube. Different implementations make different choices. This tool uses a period (.) as the 27th character by default. When encoding text, any character not in the cube's alphabet is stripped before encoding.
How the Cube Works
The 27 positions in the cube are numbered by layer (1-3), row (1-3), and column (1-3). Each letter of the alphabet plus a filler character fills the cube in the order defined by the keyword.
Choosing a Period
A period of 5 is the classic Trifid setting. A period matching the full message length gives maximum diffusion. Very short periods (2-3) are weaker because less transposition happens per block.
J and I
Standard 26-letter Trifid squares combine I and J (treating J as I) to fit 26 letters plus one filler symbol into 27 cube positions. This tool follows that convention by default.
Historical Context
Felix Delastelle published the Trifid cipher in 1902 alongside the Bifid cipher. Both were studied by cryptanalyst Louis Gilles, who proved that the Trifid cipher requires around 250 characters of ciphertext before statistical attacks become reliable.
How It Works
The Trifid cipher uses a 3x3x3 cube (27 cells) filled with the 26 letters of the alphabet plus a padding character. Each letter maps to three digits (layer, row, column). During encryption the digits from consecutive letters are grouped by position — all first digits, then all second digits, then all third digits — then read back in triplets and converted to new letters. This transposition of the digit layers is what makes the cipher stronger than the simpler Bifid cipher.
Trifid vs Bifid
Felix Delastelle invented both the Bifid and Trifid ciphers in the early 1900s. Bifid uses a 5x5 grid (25 cells, I/J share one cell) and encodes each letter as two digits. Trifid extends this to a 3x3x3 cube and encodes each letter as three digits, then interleaves all three position components across the message. The extra dimension adds one more layer of fractionation, making statistical attacks harder and requiring roughly twice the ciphertext to crack compared to Bifid.
Historical Context
Delastelle was a French amateur cryptographer working in the late 19th and early 20th centuries. He published the Trifid cipher in 1902, the same year as the Bifid. His ciphers were notable for combining substitution (letter-to-digit mapping via the cube) with transposition (rearranging the digit groups), a technique cryptographers call fractionation. Modern cryptographers study the Trifid mainly for its historical interest and as a teaching example of how fractionation strengthens classical ciphers.
When to Use This
Use this decoder to solve Trifid cipher challenges in cryptography courses, CTF competitions, or historical cipher puzzles. It is also useful for validating hand-computed Trifid encodings, exploring how changing the key square affects the output, or learning the mechanics of fractionating ciphers before studying more complex modern systems like AES or RSA.
More Free Tools
Text Diff Checker
Compare two blocks of text and see exactly which lines were added or removed.
Lua Script Generator
Generate complete Lua scripts for Love2D, Roblox, ComputerCraft, WoW addons, Hammerspoon, Redis, and CLI.
Random Password Generator
Generate strong, random passwords with custom length and character options.
100 Emoji Generator
Generate a long string of any emoji with separators, prefix text, and a live UTF-8 byte count.