Report Tool or Give Us Suggestions

Trifid Cipher

Encode and decode text using the classical Trifid cipher, combining 3-dimensional coordinate fractionation with transposition.

L ading . . .

What is the Trifid Cipher?

The Trifid Cipher is a classical symmetric cipher invented by the French amateur cryptographer Félix Delastelle and published in 1901. It is a direct and ingenious extension of his own **Bifid cipher**. While the Bifid cipher fractionates characters into two components (row and column) using a 2D $5 \times 5$ grid, the Trifid cipher fractionates characters into **three components** using a 3D $3 \times 3 \times 3$ grid (a cube).

By using three-dimensional fractionation, the Trifid cipher achieves even higher diffusion and confusion, making it significantly more difficult to crack using simple frequency analysis compared to other classical pen-and-paper ciphers.

Mathematical Coordinates in 3D Space

Let $\mathcal{A}$ be an alphabet consisting of $27$ characters (typically $26$ letters of the English alphabet plus a symbol such as a period ., space, or plus sign +). The 3D grid maps each character $m \in \mathcal{A}$ to a unique coordinate triplet: $$\Phi(m) = (l, r, c) \quad \text{where} \quad l, r, c \in \{0, 1, 2\}$$ Here, $l$ represents the layer (Z-axis), $r$ represents the row (Y-axis), and $c$ represents the column (X-axis).

For a block of text of period $P$, the characters are denoted as: $$M = (m_1, m_2, \dots, m_P)$$ And their coordinate representations are: $$\Phi(m_i) = (l_i, r_i, c_i) \quad \text{for} \quad i = 1, \dots, P$$

3-Way Transposition and Recombination

The coordinates are written in three separate rows and then read horizontally to form a single sequence of length $3P$: $$S = (l_1, l_2, \dots, l_P, r_1, r_2, \dots, r_P, c_1, c_2, \dots, c_P)$$ We regroup this flat sequence into new coordinate triplets: $$(l'_i, r'_i, c'_i) = (S_{3i-2}, S_{3i-1}, S_{3i}) \quad \text{for} \quad i = 1, \dots, P$$ The corresponding ciphertext characters are retrieved via the inverse mapping: $$c'_i = \Phi^{-1}(l'_i, r'_i, c'_i)$$

Step-by-Step Trifid Example

Let's encrypt the word "HELLOWORLD" using the key "TRIFID", period **5**, and extra character **"."**:

  1. Generate the 3x3x3 Cube: Using the keyphrase "TRIFID" and appending the remaining letters + ".", we get the 27-character grid:
    Layer 0:
    T R I F D A B C E
    Layer 1:
    G H K L M N O P Q
    Layer 2:
    S U V W X Y Z . [Space]
  2. Fractionate the first block "HELLO": Find the coordinates of H, E, L, L, O in the cube:
    • H $\to$ Layer 1, Row 0, Col 1
    • E $\to$ Layer 0, Row 2, Col 2
    • L $\to$ Layer 1, Row 1, Col 0
    • L $\to$ Layer 1, Row 1, Col 0
    • O $\to$ Layer 1, Row 2, Col 0
  3. Write coordinates horizontally:
    Layers: 1  0  1  1  1
    Rows:   0  2  1  1  2
    Cols:   1  2  0  0  0
    Stream: 1, 0, 1, 1, 1, 0, 2, 1, 1, 2, 1, 2, 0, 0, 0
  4. Re-group coordinates into triplets:
    • (1, 0, 1) $\to$ **H**
    • (1, 1, 0) $\to$ **L**
    • (2, 1, 1) $\to$ **Y**
    • (2, 1, 2) $\to$ **Z**
    • (0, 0, 0) $\to$ **T**
    So "HELLO" enciphers to **"HLYZT"**.

Frequently Asked Questions

Why does the Trifid cipher require 27 characters?

The Trifid cipher uses a three-dimensional grid or cube of size 3x3x3, which equals exactly 27 slots. Since the standard English alphabet has 26 letters, one additional character (usually a space, a period, or a plus sign) must be added to fill the 27th slot.

What makes the Trifid cipher stronger than the Bifid cipher?

By fractionating characters into three coordinate components instead of two, the Trifid cipher spreads information across three separate coordinates. The block-based transposition then diffuses these coordinates further, making character correlation significantly more complex and more difficult for cryptographic attacks to analyze.

What happens to punctuation and numbers in the Trifid cipher?

Characters that are not part of the 27-character alphabet are called non-cube characters. In this tool, you can choose to "Keep in output", which preserves their original indices and letter casing in the text, or "Remove / Ignore" to strip them out.

Can I use custom keys with the Trifid cipher?

Yes! You can enter any custom keyphrase in the settings panel. The tool will automatically clean the keyphrase, filter out duplicate letters, and place them at the beginning of the 3x3x3 grid, filling the remaining slots with the rest of the alphabet and your chosen 27th character in alphabetical order.

Is the Trifid cipher used for modern data security?

No, like all classical pen-and-paper ciphers, the Trifid cipher is not secure against modern computer-based attacks. It can be easily decrypted using ciphertext-only attacks such as simulated annealing or dictionary lookups on block patterns. It is used today primarily for education, brain teasers, and historical cryptography study.

logo OnlineMiniTools

OnlineMiniTools.com is your ultimate destination for a wide range of web-based tools, all available for free.

Feel free to reach out with any suggestions or improvements for any tool at admin@onlineminitools.com. We value your feedback and are continuously striving to enhance the tool's functionality.

© 2026 OnlineMiniTools . All rights reserved.

Hosted on Hostinger

v1.10.0