The Bifid cipher begins with a familiar object: a Polybius square. That square turns letters into coordinates, so a letter is no longer just a letter. It becomes a pair of numbers: row and column.
For example, in a 5×5 square, a letter might become D = 24, meaning row 2, column 4. Many simple coordinate ciphers stop there. They replace every letter with its coordinate and leave the message as a stream of number pairs.
Bifid does something more interesting. It splits those coordinates apart, takes the row numbers and column numbers from a block of letters, recombines them in a new order, and then turns the new coordinate pairs back into letters.
That process is called fractionation. The plaintext letters are broken into pieces, the pieces are mixed, and the mixed pieces are reassembled into ciphertext letters. Polybius gives letters an address. Bifid takes the address apart.
Bifid cipher at a glance
| Feature | Bifid Cipher |
|---|---|
| Type | Fractionating classical cipher |
| Main idea | Convert letters to Polybius coordinates, mix coordinates in blocks, convert back to letters |
| Square | 5×5 Polybius square |
| Alphabet handling | I/J usually merged |
| Key | Keyword used to build the square |
| Example keyword | CIPHER |
| Example square alphabet | CIPHERABDFGKLMNOQSTUVWXYZ |
| Period / block size | Controls how many letters are mixed at once |
| Example block size | 5 |
| Example plaintext | DEFEND THE EAST WALL |
| Example ciphertext | RRMZZD CHT ZDUA MALL |
| Closest relatives | Polybius Square, Playfair, Trifid, ADFGX |
| Security | Historical / educational only |
| Best use | Learning Polybius coordinates, fractionation, diffusion, and classical cipher design |
The Bifid cipher combines a Polybius square with transposition and fractionation. That combination is the important part: Polybius supplies coordinates, transposition rearranges those coordinates, and fractionation spreads information across letters.
This site's tool describes this exactly: each letter becomes a row-column pair inside a 5×5 square, and Bifid mixes those coordinates inside fixed-size blocks before converting them back into letters.
What is the Bifid cipher?
The Bifid cipher is a classical cipher that combines two ideas:
- Coordinate substitution.
- Transposition of coordinate parts.
The coordinate part comes from the Polybius Square.
A Polybius Square puts letters into a 5×5 grid. Each letter is represented by its row and column.
| Coordinate | Meaning |
|---|---|
| 11 | Row 1, column 1 |
| 24 | Row 2, column 4 |
| 55 | Row 5, column 5 |
Bifid then takes these coordinate pairs and rearranges them.
This gives it a different character from simple substitution. In a Caesar cipher, one plaintext letter becomes one ciphertext letter by shifting the alphabet. In a Polybius Square, one plaintext letter becomes one coordinate pair. In Bifid, a plaintext letter is first broken into two parts: row and column. Those parts are then mixed with coordinate parts from nearby letters.
That is why Bifid is called a fractionating cipher. It breaks letters into fractions of information, then recombines those fractions.
How does the Bifid cipher work?
Bifid encryption has four main stages:
- Build a Polybius square.
- Convert plaintext letters into row-column coordinates.
- Mix the coordinate numbers inside fixed-size blocks.
- Convert the new coordinate pairs back into letters.
The period, or block size, controls how many letters are mixed at once.
This site's tool makes this point clearly:
Block size is the real Bifid period. Group letters is only display formatting.
That distinction matters. A display group might make ciphertext easier to read, but the Bifid period changes the actual encryption.
If the period is 5, Bifid mixes letters in blocks of 5. If the period is 10, it mixes letters in blocks of 10.
The key square
Bifid normally uses a 5×5 Polybius square. Because a 5×5 square has only 25 cells, the letters I and J are usually merged.
This site's Bifid tool uses:
- a 5×5 square
- I/J merged
- a keyword
- duplicate keyword letters removed automatically
- J merged into I
With the keyword:
CIPHER
the square alphabet in the tool is:
CIPHERABDFGKLMNOQSTUVWXYZ
That gives this square:
| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| 1 | C | I/J | P | H | E |
| 2 | R | A | B | D | F |
| 3 | G | K | L | M | N |
| 4 | O | Q | S | T | U |
| 5 | V | W | X | Y | Z |
So the coordinates are:
| Letter | Coordinate | Letter | Coordinate |
|---|---|---|---|
| C | 11 | R | 21 |
| I/J | 12 | A | 22 |
| P | 13 | B | 23 |
| H | 14 | D | 24 |
| E | 15 | F | 25 |
| G | 31 | O | 41 |
| K | 32 | Q | 42 |
| L | 33 | S | 43 |
| M | 34 | T | 44 |
| N | 35 | U | 45 |
| V | 51 | W | 52 |
| X | 53 | Y | 54 |
| Z | 55 |
The square controls everything. Change the keyword, and every coordinate can change. That is why the square is the first real key component of the Bifid cipher.
Key and rules
The Bifid cipher has two main settings:
- The keyword for the Polybius square.
- The period or block size.
The keyword controls the square. The period controls how much coordinate mixing happens at once.
| Rule | Explanation |
|---|---|
| Build a 5×5 square | Usually with I/J merged |
| Use a keyword | Unique keyword letters appear first in the square |
| Remove duplicate keyword letters | Repeated letters do not appear twice |
| Convert plaintext letters to coordinates | Each letter becomes row and column |
| Work in blocks | The period controls the block size |
| Split coordinates into rows and columns | Row numbers and column numbers are written separately |
| Recombine the coordinate stream | Read rows first, then columns, then pair the digits again |
| Convert new pairs back to letters | The new coordinates produce the ciphertext |
| Use the same square and period to decrypt | Wrong settings prevent clean decryption |
The period is not just cosmetic. It changes the cipher.
Worked example: DEFEND THE EAST WALL
Now encrypt:
DEFEND THE EAST WALL
using:
| Setting | Value |
|---|---|
| Keyword | CIPHER |
| Block size | 5 |
| I/J | Merged |
First remove the spaces for the actual letter processing:
DEFENDTHEEASTWALL
The tool can preserve spaces visually, but the cipher's letter operation works on the letter stream. The example output appears with spaces preserved as:
RRMZZD CHT ZDUA MALL
The letters-only ciphertext is:
RRMZZDCHTZDUAMALL
Now split the plaintext letters into blocks of 5:
| Block | Plaintext |
|---|---|
| 1 | DEFEN |
| 2 | DTHEE |
| 3 | ASTWA |
| 4 | LL |
Because the final block is short, it is handled as a shorter block.
Block 1: DEFEN
Using the keyword square:
| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| 1 | C | I/J | P | H | E |
| 2 | R | A | B | D | F |
| 3 | G | K | L | M | N |
| 4 | O | Q | S | T | U |
| 5 | V | W | X | Y | Z |
Find the coordinates for:
D E F E N
| Letter | Coordinate | Row | Column |
|---|---|---|---|
| D | 24 | 2 | 4 |
| E | 15 | 1 | 5 |
| F | 25 | 2 | 5 |
| E | 15 | 1 | 5 |
| N | 35 | 3 | 5 |
Now write the row numbers first:
2 1 2 1 3
Then the column numbers:
4 5 5 5 5
Put those together:
2 1 2 1 3 4 5 5 5 5
Now split into new coordinate pairs:
| New pair | Letter |
|---|---|
| 21 | R |
| 21 | R |
| 34 | M |
| 55 | Z |
| 55 | Z |
So:
DEFEN -> RRMZZ
That is the Bifid mechanism in one block. The original coordinates were:
24 15 25 15 35
The mixed coordinates became:
21 21 34 55 55
The letters changed because the coordinate parts were split and recombined.
All blocks together
Now repeat the process for every block.
| Block | Plaintext | Ciphertext |
|---|---|---|
| 1 | DEFEN | RRMZZ |
| 2 | DTHEE | DCHTZ |
| 3 | ASTWA | DUAMA |
| 4 | LL | LL |
Join the ciphertext blocks:
RRMZZDCHTZDUAMALL
With the original word spacing preserved visually, this appears as:
RRMZZD CHT ZDUA MALL
| Item | Value |
|---|---|
| Plaintext | DEFEND THE EAST WALL |
| Keyword | CIPHER |
| Period / block size | 5 |
| Ciphertext | RRMZZD CHT ZDUA MALL |
This matches the Bifid tool example.
The result is not produced by simple substitution. The plaintext letter D begins as coordinate 24, but the first ciphertext letter is R, coordinate 21. That new coordinate was not taken directly from D alone. It came from the mixed coordinate stream of the whole block.
That is what fractionation does.
Why the block size matters
The block size is the real Bifid period.
With block size 5, the cipher mixes coordinates inside groups of 5 letters:
DEFEN | DTHEE | ASTWA | LL
Each block is fractionated separately. The coordinates from DEFEN do not mix with the coordinates from DTHEE.
If the period were longer, more letters would be mixed together. For example, with period 10, the first block would be:
DEFENDTHEE
A longer period generally spreads information more widely, but Bifid remains a historical cipher.
The period is part of the cipher key. This is different from grouping. Grouping output into blocks of five letters is only formatting:
RRMZZ DCHTZ DUAMA LL
Block size changes the cipher. Display grouping does not.
Decrypting the Bifid cipher
Decryption reverses the fractionation.
To decrypt, the receiver must know:
- the same Polybius square
- the same keyword
- the same period / block size
- the same I/J convention
Suppose the ciphertext block is:
RRMZZ
Using the same square:
| Cipher letter | Coordinate |
|---|---|
| R | 21 |
| R | 21 |
| M | 34 |
| Z | 55 |
| Z | 55 |
Write these coordinates as a stream of digits:
2 1 2 1 3 4 5 5 5 5
The block has 5 letters, so split this stream into two halves of 5 digits:
| Part | Digits |
|---|---|
| Row numbers | 2 1 2 1 3 |
| Column numbers | 4 5 5 5 5 |
Now pair the first row digit with the first column digit, the second row digit with the second column digit, and so on:
| Row | Column | Coordinate | Plain letter |
|---|---|---|---|
| 2 | 4 | 24 | D |
| 1 | 5 | 15 | E |
| 2 | 5 | 25 | F |
| 1 | 5 | 15 | E |
| 3 | 5 | 35 | N |
So:
RRMZZ -> DEFEN
Wrong period? The split happens in the wrong place. Wrong square? Coordinates become wrong letters. Wrong I/J convention? Some letters decode differently.
History and origin
The Bifid cipher is associated with the French cryptographer Félix Delastelle and is usually dated to around 1900 or 1901.
Delastelle is important in classical cryptography because he explored ciphers based on fractionation: breaking letters into parts and recombining those parts in new ways.
That idea gives Bifid a different feel from earlier hand ciphers. A Caesar cipher shifts letters. A monoalphabetic substitution cipher replaces letters. A Playfair cipher encrypts letter pairs. Bifid breaks each letter into coordinates, then mixes coordinate parts across a period.
The cipher is still small enough to do by hand, but conceptually it points toward something larger: encryption can work by decomposing symbols, moving the pieces, and recombining them.
Bifid is not modern encryption, but it shows an old attempt to create more diffusion using pencil-and-paper methods.
Why Bifid was useful
Bifid was useful because it improved on plain coordinate substitution.
A simple Polybius Square maps each letter to one coordinate pair. That is easy to understand, but also easy to attack. If E always becomes 15, then 15 behaves like E.
Bifid makes the situation less direct. It takes the Polybius coordinates and mixes them before converting them back to letters. That means the final ciphertext letters do not correspond one-to-one with the original plaintext letters in the same simple way.
| Advantage | Why it mattered |
|---|---|
| Uses a Polybius square | Easy to construct by hand |
| Keyworded square | Changes the coordinate layout |
| Fractionates letters | Splits letters into row and column parts |
| Mixes coordinates in blocks | Spreads information across a period |
| Stronger than plain Polybius | Breaks direct coordinate substitution |
| Teaches diffusion | Shows how information can spread across positions |
| Still hand-workable | More complex, but not machine-dependent |
Bifid does not merely hide letters. It hides parts of letters.
Weaknesses and limitations
Bifid is clever, but it is not secure by modern standards.
| Weakness | Why it matters |
|---|---|
| Small 5×5 square | Only 25 cells, with I/J merged |
| Human keyword | Keywords may be short, meaningful, or guessable |
| Fixed period | The block size creates repeated structure |
| Classical fractionation | It spreads patterns but does not destroy them |
| Known-plaintext risk | Known plaintext can reveal square and period clues |
| Reused settings | Multiple messages with same square/period help attackers |
| No authentication | It does not detect tampering |
| Not modern encryption | It lacks randomness, large keys, and formal security |
The period is especially important. If the same period is used throughout the message, then the cipher has a regular block structure.
For example, with period 5:
block 1 | block 2 | block 3 | block 4
Each block is processed independently. A longer period can help by mixing more letters at once, but it does not make Bifid secure. It simply changes the size of the mixing window.
How the Bifid cipher is broken
A practical attack on Bifid usually looks for three things:
- The square.
- The period.
- The plaintext structure.
If the attacker knows or guesses that Bifid is being used, they can try likely periods. For each period, the ciphertext can be divided into blocks, converted into coordinate streams, split in half, and tested against possible Polybius squares.
If the square is keyworded, the keyword becomes part of the attack. Human-chosen keywords are often weak because people choose memorable words such as CIPHER, SECRET, CASTLE, ORANGE, or VICTORY.
An attacker may also use known or guessed plaintext. Guesses such as DEFEND, ATTACK, THE, or MESSAGE can be tested against ciphertext blocks. Because Bifid's coordinate mixing is systematic, a correct crib can reveal constraints on the square and period.
The attack is harder than attacking a plain Polybius Square, because the coordinates have been mixed. But the structure is still there. Bifid does not erase language statistics. It disrupts them.
Related ciphers and comparisons
Bifid sits naturally among ciphers that use grids, coordinates, and fractionation.
| Cipher | Relationship to Bifid |
|---|---|
| Polybius Square | Supplies the coordinate idea used by Bifid |
| Playfair Cipher | Also uses a 5×5 square, but encrypts digraphs by geometry |
| Bifid Cipher | Splits and recombines Polybius coordinates |
| Trifid Cipher | Extends the idea into a 3D coordinate system |
| ADFGX Cipher | Uses a Polybius-like square and then transposes the coordinate labels |
| ADFGVX Cipher | Expands ADFGX to a 6×6 square |
| Fractionated Morse | Breaks Morse-like symbols into parts and recombines them |
| Columnar Transposition | Rearranges positions rather than coordinate parts |
The comparison with Polybius is the most important.
Polybius: letter -> coordinate
Bifid: letter -> coordinate -> split -> mix -> new coordinate -> new letter
The comparison with Playfair is different. Both use a 5×5 square, but Playfair operates on pairs of letters while Bifid operates on coordinate components inside a period.
| Feature | Playfair | Bifid |
|---|---|---|
| Square | 5×5 | 5×5 |
| I/J | Usually merged | Usually merged |
| Unit | Digraphs | Period blocks |
| Main action | Row/column/rectangle rules | Coordinate fractionation |
| Output | Letter pairs | Recombined coordinate letters |
They share a grid. They do not share the same mechanism.
Where Bifid appears today
The Bifid cipher is less common in pop culture than Caesar, Atbash, Morse code, binary, or A1Z26. Those systems are easier to recognise quickly.
Bifid takes more setup. The reader needs to understand the Polybius square, row and column coordinates, I/J merging, keyworded squares, block periods, coordinate splitting, and coordinate recombination.
But it is common in:
- classical cryptography lessons
- online cipher tools
- recreational cryptography
- puzzle hunts
- CTF-style challenges
- codebreaking practice
- discussions of fractionation
- explanations of Delastelle ciphers
Bifid is especially good for an educational site because it connects several earlier ideas. A reader who already understands Polybius, Playfair, Rail Fence, and Columnar Transposition is ready for Bifid.
A simple Python Bifid cipher
The Bifid cipher is a good programming example because it forces you to separate the problem into clear stages: build the square, turn letters into coordinates, process text in blocks, mix coordinate digits, turn coordinates back into letters, and reverse the process for decryption.
Python exampleShow code
ALPHABET = "ABCDEFGHIKLMNOPQRSTUVWXYZ"
def clean_letters(text):
"""
Keep letters only, uppercase them, and merge J into I.
"""
result = ""
for char in text.upper():
if char.isalpha():
if char == "J":
result += "I"
else:
result += char
return result
def build_square(keyword):
"""
Build a 5x5 Polybius square from a keyword.
"""
keyword = clean_letters(keyword)
letters = []
seen = set()
for char in keyword + ALPHABET:
if char not in seen:
seen.add(char)
letters.append(char)
square = []
letter_to_coord = {}
coord_to_letter = {}
index = 0
for row in range(1, 6):
square_row = []
for col in range(1, 6):
letter = letters[index]
square_row.append(letter)
letter_to_coord[letter] = (row, col)
coord_to_letter[(row, col)] = letter
index += 1
square.append(square_row)
return square, letter_to_coord, coord_to_letter
def encrypt_block(block, letter_to_coord, coord_to_letter):
"""
Encrypt one Bifid block.
"""
rows = []
cols = []
for letter in block:
row, col = letter_to_coord[letter]
rows.append(row)
cols.append(col)
mixed_numbers = rows + cols
ciphertext = ""
for i in range(0, len(mixed_numbers), 2):
pair = (mixed_numbers[i], mixed_numbers[i + 1])
ciphertext += coord_to_letter[pair]
return ciphertext
def decrypt_block(block, letter_to_coord, coord_to_letter):
"""
Decrypt one Bifid block.
"""
numbers = []
for letter in block:
row, col = letter_to_coord[letter]
numbers.append(row)
numbers.append(col)
half = len(numbers) // 2
rows = numbers[:half]
cols = numbers[half:]
plaintext = ""
for i in range(len(block)):
pair = (rows[i], cols[i])
plaintext += coord_to_letter[pair]
return plaintext
def bifid_encrypt(plaintext, keyword, period=5):
"""
Encrypt plaintext with the Bifid cipher.
"""
if period < 1:
raise ValueError("Period must be at least 1.")
text = clean_letters(plaintext)
square, letter_to_coord, coord_to_letter = build_square(keyword)
ciphertext = ""
for start in range(0, len(text), period):
block = text[start:start + period]
ciphertext += encrypt_block(block, letter_to_coord, coord_to_letter)
return ciphertext
def bifid_decrypt(ciphertext, keyword, period=5):
"""
Decrypt ciphertext with the Bifid cipher.
"""
if period < 1:
raise ValueError("Period must be at least 1.")
text = clean_letters(ciphertext)
square, letter_to_coord, coord_to_letter = build_square(keyword)
plaintext = ""
for start in range(0, len(text), period):
block = text[start:start + period]
plaintext += decrypt_block(block, letter_to_coord, coord_to_letter)
return plaintext
def group_text(text, size=5):
"""
Group text into blocks for display.
"""
groups = []
for i in range(0, len(text), size):
groups.append(text[i:i + size])
return " ".join(groups)
def print_square(square):
"""
Display the 5x5 square.
"""
for row in square:
print(" ".join(row))
keyword = "CIPHER"
plaintext = "DEFEND THE EAST WALL"
period = 5
square, _, _ = build_square(keyword)
ciphertext = bifid_encrypt(plaintext, keyword, period)
decrypted = bifid_decrypt(ciphertext, keyword, period)
print("Keyword square:")
print_square(square)
print()
print("Plaintext :", plaintext)
print("Keyword :", keyword)
print("Period :", period)
print("Encrypted :", ciphertext)
print("Grouped :", group_text(ciphertext, 5))
print("Decrypted :", decrypted)
Expected output:
Keyword square:
C I P H E
R A B D F
G K L M N
O Q S T U
V W X Y Z
Plaintext : DEFEND THE EAST WALL
Keyword : CIPHER
Period : 5
Encrypted : RRMZZDCHTZDUAMALL
Grouped : RRMZZ DCHTZ DUAMA LL
Decrypted : DEFENDTHEEASTWALL
The key line in encryption is not a single formula. It is this idea:
mixed_numbers = rows + cols
That line performs the fractionation step.
It takes row numbers and column numbers:
Rows: 2 1 2 1 3
Columns: 4 5 5 5 5
and makes one stream:
2 1 2 1 3 4 5 5 5 5
Then this stream is split into new coordinate pairs:
21 21 34 55 55
Those new pairs become ciphertext letters.
Reading the code like the cipher
The square starts with:
ALPHABET = "ABCDEFGHIKLMNOPQRSTUVWXYZ"
There is no J because I and J share one cell.
The function clean_letters(text) keeps letters only and converts J into I. So JIG becomes IIG.
The function build_square(keyword) creates the Polybius square. For the keyword CIPHER, it creates:
C I P H E
R A B D F
G K L M N
O Q S T U
V W X Y Z
The encryption function processes the text in period blocks:
for start in range(0, len(text), period):
block = text[start:start + period]
If the period is 5, then:
DEFENDTHEEASTWALL
becomes:
DEFEN | DTHEE | ASTWA | LL
Inside each block, the code stores row numbers and column numbers separately, then performs the Bifid mixing:
mixed_numbers = rows + cols
Decryption reverses this. It takes the ciphertext coordinates, flattens them into a number stream, splits the stream in half, and rebuilds the original row-column pairs.
Common questions about the Bifid cipher
Is the Bifid cipher secure?
No. The Bifid cipher is not secure by modern standards. It is stronger and more interesting than simple substitution, but it is still a classical hand cipher with a fixed square, a fixed period, and exploitable structure.
It should be used for learning, puzzles, and historical interest only.
What does Bifid mean?
Bifid means split into two parts. That fits the cipher because each letter is split into two coordinate components: row and column.
Is Bifid based on the Polybius Square?
Yes. Bifid starts by converting letters into Polybius square coordinates. Then it fractionates those coordinates before converting them back into letters.
So Polybius is the foundation. Bifid is the fractionating extension.
What is the Bifid period?
The period is the block size. It controls how many letters are mixed together before the cipher moves on to the next block.
For example, with period 5:
DEFEN | DTHEE | ASTWA | LL
Each block is processed separately.
Is grouping the same as the Bifid period?
No. The Bifid period changes the encryption. Grouping only changes how the output is displayed.
Why do I and J share a cell?
The standard Bifid square is 5×5. That gives 25 cells. The English alphabet has 26 letters. So I and J are usually merged into one cell, just as in the Polybius Square and Playfair cipher.
What is a good Bifid example?
A clean example is:
| Item | Value |
|---|---|
| Plaintext | DEFEND THE EAST WALL |
| Keyword | CIPHER |
| Period | 5 |
| Ciphertext | RRMZZD CHT ZDUA MALL |
This is the example from the Bifid tool.
How is Bifid different from Playfair?
Both use a 5×5 square, but they work differently. Playfair encrypts pairs of letters using row, column, and rectangle rules. Bifid converts letters to coordinates, splits those coordinates, mixes them inside blocks, and converts them back to letters.
How is Bifid different from Polybius?
Polybius directly maps each letter to a coordinate. Bifid uses those coordinates as raw material, then rearranges the coordinate digits before turning them back into letters.
Polybius: letter -> coordinate
Bifid: letter -> coordinate -> mixed coordinate -> new letter
Why the Bifid cipher still matters
The Bifid cipher should not be used to protect anything serious.
Not passwords.
Not private messages.
Not financial information.
Not personal data.
Not recovery phrases.
Not API keys.
Modern encryption depends on carefully analysed algorithms, large keys, secure randomness, authentication, and resistance to many forms of attack. Bifid has none of that.
But it still earns its place.
It shows how a Polybius square can become more than a coordinate chart. It shows how letters can be split into parts. It shows how row and column numbers can be mixed. It shows why block size matters. It shows how diffusion can appear in a hand cipher. It shows how substitution and transposition can start to merge.
Most importantly, it teaches that a cipher can operate below the level of whole letters.
A letter can be broken open. Its row can move away from its column. Its pieces can be recombined with pieces from nearby letters.
That is why the Bifid cipher still matters. Not because it is secure today, but because it shows classical cryptography becoming more structural.