Skip to content

Bifid cipher encoder and decoder

How it works

The Bifid cipher begins with a five-by-five Polybius square. Each plaintext letter has a row digit and a column digit. Instead of keeping those two digits together, Bifid writes all row digits for a block on one line and all column digits beneath them. It then reads the first line followed by the second and pairs the combined stream again.

Those new coordinate pairs point back into the same square and produce ciphertext letters. A single plaintext letter therefore influences neighboring output positions: its row and column can be separated and paired with coordinates from other letters. This mixing is called fractionation and hides simple one-letter frequency patterns better than an untouched Polybius substitution.

The period controls the block length. With period 5, the tool processes five letters at a time, resets the two coordinate rows, and continues with the next block. A longer period mixes a larger region. Decoding must use exactly the same period and grid keyword. The final short block uses its actual length.

The square merges J into I. An optional keyword fills unique letters first and then the remaining alphabet. Spaces and punctuation are stripped by default. They can be preserved visually for input handling, but the classical fractionation itself operates on the normalized letter stream.

Worked example

Encode HELLO with the standard I/J Polybius square and period 5. Its coordinates are H=23, E=15, L=31, L=31, and O=34.

StageValuesPairsLetters
Original coordinates23 15 31 31 3423 · 15 · 31 · 31 · 34HELLO
Row line2 1 3 3 3
Column line3 5 1 1 4
Joined stream2 1 3 3 3 3 5 1 1 421 · 33 · 33 · 51 · 14F N N V D
  1. Find the coordinates: Write H=23, E=15, L=31, L=31, and O=34.
  2. Separate the coordinate rows: Write 2 1 3 3 3 above 3 5 1 1 4.
  3. Read and re-pair: Join the lines and split them as 21, 33, 33, 51, and 14.
  4. Look up the new letters: Those pairs identify F, N, N, V, and D, producing FNNVD.

The ciphertext is FNNVD. Decoding converts those letters to ten coordinate digits, splits the stream into five row digits and five column digits, then recombines positions to recover HELLO.

History and origin

French amateur cryptographer Félix Delastelle developed Bifid near the end of the nineteenth century and described related fractionating systems in his work on new cryptography. His designs combined simple geometric substitutions with transposition-like rearrangement so they could still be performed with pencil and paper.

Bifid belongs to the same family as Delastelle's Trifid cipher, which extends the coordinates into three dimensions. These systems became enduring examples in classical-cryptography books because they demonstrate how fractionation spreads plaintext structure across multiple ciphertext characters without machines.

How to break it

Bifid is not secure by modern standards. The period creates repeating block boundaries, and the Polybius square contains only twenty-five symbols. Analysts can test likely periods, search for a keyed square, and score candidate plaintext with language statistics. Long ciphertexts provide enough repeated structure for automated optimization methods.

Classical attacks use probable words, digraph statistics, and knowledge of the period. Modern solvers can use hill climbing or simulated annealing to rearrange the square while measuring whether the decoded output resembles natural language. A short period reduces mixing and generally makes patterns easier to exploit.

The cipher is stronger than a plain Polybius square for a hand puzzle, but that comparison does not make it safe for real secrets. Use it to study fractionation, construct puzzle trails, or reproduce historical techniques. Use established modern cryptography for any data that needs confidentiality.

Frequently asked questions

How does the Bifid cipher work?

It writes Polybius row and column digits on separate lines, joins those lines within each period, pairs the digits again, and looks up new letters.

What is the period in a Bifid cipher?

The period is the number of letters fractionated as one block. Encoding and decoding must use the same whole-number period.

Does Bifid combine I and J?

This implementation uses a twenty-five-letter Polybius square where J is normalized to I.

Can a Bifid cipher use a keyword?

Yes. Unique keyword letters fill the grid first, followed by unused alphabet letters. The same keyed square is required to decode.

What does HELLO become with period 5?

With the standard alphabetical square, HELLO becomes FNNVD.

Is the Bifid cipher secure?

No. Period analysis and computerized language scoring can recover long messages and keyed squares. It is a historical and educational cipher.

Privacy note

All processing happens in your browser. Your text never leaves your device and is never transmitted to ToolPlex.