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.
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.
Enter text above to see the result here.
Polybius square
1
2
3
4
5
1
2
3
4
5
How to use Bifid Cipher
- 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
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
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
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
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?
How does the Bifid cipher work?
Who invented the Bifid cipher?
What is the period in a Bifid cipher?
What does the keyword do?
What is the difference between the 5×5 and 6×6 squares?
Can you show a worked Bifid example?
How do you decode a Bifid cipher?
How is Bifid different from the Polybius square?
How secure is the Bifid cipher?
What is the difference between Bifid and Trifid?
Is my text uploaded to a server?
Related tools
Keep going with these handy tools