T

Text Machine

Powerful text tools, in your browser

Bifid Cipher

Encode and decode the Bifid cipher, which fractionates each letter into Polybius coordinates and then mixes them so every output letter depends on two inputs. Set the period, switch between the 5×5 and 6×6 squares, add an optional keyword, follow the live fractionation, and copy, download, or share the result. Everything runs in your browser.

Cipher settings

Square

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.

Polybius square

1

2

3

4

5

1

A
B
C
D
E

2

F
G
H
I/J
K

3

L
M
N
O
P

4

Q
R
S
T
U

5

V
W
X
Y
Z

How to use Bifid Cipher

  1. 1

    Choose encode or decode

    Pick Encode to turn plain text into Bifid cipher text, or Decode to turn cipher text back into plain text.

  2. 2

    Pick the square and keyword

    Choose the classic 5×5 square, where I and J share a cell, or the 6×6 square, which adds the digits 0 to 9. Leave the keyword blank for the plain square or enter one to mix it.

  3. 3

    Set the period

    Choose the block size the cipher works in. A period of 0 treats the whole message as one block. Both sides must use the same period.

  4. 4

    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 row and column digits.

  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, square, keyword, and period ready to go.

Understanding the Bifid Cipher

What is the Bifid cipher?

The Bifid cipher is a classical cipher invented by the French cryptographer Félix-Marie Délastelle around 1901. It builds directly on the Polybius square: every letter is first turned into a pair of coordinates — its row and its column — and then those coordinates are shuffled together before being read back as letters. This two-stage design combines substitution with transposition, which is what gives Bifid its strength compared with a plain Polybius substitution.

The clever part is the mixing. Because the row and column digits of neighbouring letters are interleaved before they are paired up again, each letter of the output ends up depending on two different letters of the input. That spreading of information — known as diffusion — hides the tell-tale letter-frequency patterns that make simple substitution ciphers so easy to crack, and it makes Bifid a favourite teaching example for how fractionation strengthens a cipher.

How the Bifid cipher works

Encoding happens in three steps. First, fractionation: each letter is looked up in the square and replaced by its row number and its column number. Second, the coordinates of a block of letters are written out as two rows — all the row digits on the top line and all the column digits on the bottom line. Third, that combined run of digits is read straight across, taken two at a time, and each pair is looked up in the square as a row and column to produce a cipher letter.

Writing the rows first and the columns second 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 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 digits drift apart into two separate output letters.

The Polybius square: 5×5 and 6×6

Bifid needs a Polybius square to read coordinates from, and you can choose its size. The classic 5×5 square holds 25 cells, one short of the 26-letter alphabet, so by tradition I and J share a cell; a J you encode therefore comes back as an I when you decode. Rows and columns are numbered 1 to 5, and this is the version used in almost every textbook example of Bifid.

The 6×6 square holds 36 cells — all 26 letters plus the digits 0 to 9 — so nothing is merged and both letters and numbers survive a round trip exactly. You can also mix either square with a keyword: the keyword's unique letters are written in first, in order and without repeats, and the rest of the alphabet follows, just as a keyed Playfair or Polybius square is built. The live grid highlights the keyword letters so you can see the mixing.

The period, or block size

The period is the block size Bifid works in. The text is divided into blocks of that many letters, and the row-then-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. Common choices are periods of five to ten letters, 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 square and the text stay the same — that sensitivity is the whole point of the block structure.

A worked Bifid example

Take the word HELLO with the plain 5×5 square and a period covering the whole word. First fractionate: H is row 2 column 3, E is row 1 column 5, L is row 3 column 1, the second L is row 3 column 1 again, and O is row 3 column 4. Writing the rows on one line gives 2 1 3 3 3, and the columns on the next line give 3 5 1 1 4.

Now read the two lines straight across as a single run — 2 1 3 3 3 3 5 1 1 4 — and take the digits in pairs: 21, 33, 33, 51, 14. Looking each pair up in the square as a row and column gives F, N, N, V and D, so HELLO encodes to FNNVD. Notice how the repeated L's no longer appear as a repeated pattern in the output — that is the diffusion at work. With a period of 3 the same word instead becomes FNVND, because the blocks break in a different place.

Decoding a Bifid cipher

Decoding runs the steps in reverse. For each block, you read off the coordinates of the cipher letters in order, which reproduces the combined run of digits. Splitting that run in half gives the original row digits in the first half and the original column digits in the second, and pairing each row with its matching column rebuilds the plaintext letters. The tool does all of this for you when you choose Decode.

To decode correctly you must use the same three settings that were used to encode: the same square size, the same keyword, and the same period. Get any of them wrong and the coordinates split in the wrong place, producing garbled text — which is exactly the property that makes the cipher useful. Remember too that with the 5×5 square an original J returns as an I, because the two letters shared a cell.

History and security of the Bifid cipher

Félix Délastelle published the Bifid cipher in his 1902 treatise on cryptography, alongside its relatives the Trifid cipher, which uses a three-dimensional grid, and the four-square and two-square ciphers. Bifid was never a military-grade system, but it was an important step in showing how combining fractionation with transposition could defeat simple frequency analysis, and it remains a staple of puzzles, cipher challenges, and cryptography courses.

By modern standards Bifid is not secure. Cryptanalysts have well-established methods for breaking it, especially when the period is known or short and enough cipher text is available, and a keyword only raises the bar a little. Its real value today is educational: it is a clear, hands-on way to see why diffusion matters. For protecting real information, always use a modern, peer-reviewed algorithm such as AES, and keep Bifid for learning, puzzles, and capture-the-flag challenges.

Frequently asked questions

What is the Bifid cipher?
The Bifid cipher is a classical cipher invented by Félix Délastelle around 1901. It turns each letter into its row and column coordinates on a Polybius square, then interleaves those coordinates before reading them back as letters. By combining substitution with transposition it spreads each letter's influence across two output letters, which hides the frequency patterns that make simple ciphers easy to break.
How does the Bifid cipher work?
Each letter is replaced by its row digit and its column digit from the square. For a block of letters, all the row digits are written on one line and all the column digits on the next; that combined run is then read across in pairs, and each pair is looked up as a row and column to give a cipher letter. Decoding reverses the process: the cipher letters' coordinates split back into the original rows and columns.
Who invented the Bifid cipher?
The Bifid cipher was created by the French cryptographer Félix-Marie Délastelle, who described it around 1901 and published it in his 1902 work on cryptography. He also devised the related Trifid, four-square, and two-square ciphers. Bifid was an early demonstration that fractionating letters into coordinates and mixing them could strengthen a cipher against frequency analysis.
What is the period in a Bifid cipher?
The period is the block size. The message is split into blocks of that many letters, and the row-and-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 does the keyword do?
A keyword scrambles the underlying Polybius square. Its unique letters are written into the grid 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 square size and period. Leaving the keyword blank uses the plain alphabetical square.
What is the difference between the 5×5 and 6×6 squares?
The 5×5 square has 25 cells, so two letters — usually I and J — share one cell to fit the 26-letter alphabet, and a J decodes back as an I. The 6×6 square has 36 cells, enough for all 26 letters plus the digits 0 to 9 with nothing merged, so letters and numbers round-trip exactly. Use 5×5 for classic examples and 6×6 when you need digits.
Can you show a worked Bifid example?
Using the plain 5×5 square over the whole word, HELLO fractionates to rows 2 1 3 3 3 and columns 3 5 1 1 4. Reading those as one run, 2 1 3 3 3 3 5 1 1 4, and pairing the digits gives 21 33 33 51 14, which look up as F N N V D. So HELLO encodes to FNNVD. With a period of 3 the same word becomes FNVND instead, because the blocks break in a different place.
How do you decode a Bifid cipher?
Read off the coordinates of the cipher letters in order to rebuild the combined run of digits, then split it in half: the first half are the plaintext row digits and the second half are the column digits. Pairing each row with its matching column recovers the letters. In this tool, choose Decode and set the same square, keyword, and period that were used to encode.
How is Bifid different from the Polybius square?
The Polybius square simply replaces each letter with its two coordinate digits, so it is a straight substitution and the digits of one letter never mix with another. Bifid adds a transposition step: it interleaves the rows and columns of a whole block before pairing the digits again, so each output letter depends on two input letters. That extra mixing is what makes Bifid much harder to break than a plain Polybius cipher.
How secure is the Bifid cipher?
Not secure by modern standards. Although its diffusion defeats simple frequency analysis, cryptanalysts have reliable methods for breaking Bifid, 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 Bifid for puzzles and learning.
What is the difference between Bifid and Trifid?
Both were invented by Délastelle and work the same way, but Trifid uses three coordinates per letter instead of two, taken from a 3×3×3 cube of 27 symbols rather than a flat square. Trifid therefore fractionates each letter into three parts and mixes them across a block, giving even more diffusion than Bifid. Bifid is the simpler, two-coordinate version and the more common one in puzzles.
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, square, 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

Trifid Cipher

Polybius Square

Four-Square Cipher

Two-Square Cipher

Caesar Cipher

Vigenère Cipher