T

Text Machine

Powerful text tools, in your browser

Turning Grille Cipher

Encode and decode the turning grille, also known as the Fleissner grille. A square card with a quarter of its cells punched out is laid over an empty grid; you write the message through the holes, turn the card ninety degrees, and write again, until four turns have filled the grid. Read the grid off row by row and you have the cipher. Pick a grid size, set a keyword to build the grille, and watch the live grille-and-grid diagram. Everything runs in your browser.

Grille

Keyword

Grid size

The keyword builds the grille: the holes punched out of the card. The grid's cells fall into groups of four that rotate into one another, and each keyword letter picks which cell of one group is punched, so exactly one hole comes from each group — the rule that lets four turns fill the grid perfectly. A different keyword makes a different hole pattern. Only letters count, and both sides must use the same keyword and the same grid size.

Plain text
Cipher text

Enter text above to see the result here.

Grille diagram

Example: a sample message filling the grid through the grille across four quarter-turns. Type your own text above to update it.

The grille (turn 1 holes)

The grid (coloured by turn)

T
T
M
I
D
R
E
E
H
E
N
T
M
E
E
I
E
G
T
H
O
O
A
L
D
D
T
T
O
A
B
A
Y
K
Y
M

Turn 1

Turn 2

Turn 3

Turn 4

How to use Turning Grille Cipher

  1. 1

    Choose encode or decode

    Pick Encode to scramble plain text with the turning grille, or Decode to turn grille cipher text back into plain text.

  2. 2

    Set the keyword

    Type a keyword to build the grille. Each letter chooses which cells are punched out as holes. Use the same keyword on both sides.

  3. 3

    Choose the grid size

    Pick a 4×4, 6×6, or 8×8 grid. A larger grid scrambles longer chunks of text at once. Both sides must use the same size.

  4. 4

    Type or paste your text

    Enter your message and it is converted as you type. The diagram shows the grille and the grid, with each cell coloured by the turn that filled it.

  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, keyword, and grid size ready to go.

Understanding the Turning Grille Cipher

What is the turning grille cipher?

The turning grille is a transposition cipher: it hides a message not by changing the letters but by scrambling the order they are written in. The tool of the cipher is the grille itself — a stiff square card with some of its cells cut away as holes. You place the grille over an empty grid of the same size, write the first letters of your message through the holes, then rotate the card a quarter-turn and write the next letters through the holes in their new positions. After four turns the card has covered every cell of the grid exactly once, and the grid, read off in ordinary reading order, is your cipher text.

Its best-known form is named after Eduard Fleissner von Wostrowitz, an Austrian colonel who described it in 1881, and it was famously adopted by the German army on the Western Front in 1916. Because the same square is read in a completely different order from the one it was written in, the letters are thoroughly shuffled while every single one is preserved — which is the signature of a transposition cipher and what makes the turning grille a favourite teaching example to this day.

The grille and the grid

Everything depends on the holes. Take a grid with an even number of cells on each side — 4×4, 6×6, or 8×8 here — and notice that its cells come in families of four: any cell, together with the three cells it lands on as the square is turned through ninety, one hundred eighty, and two hundred seventy degrees. A 4×4 grid has four such families, a 6×6 grid has nine, an 8×8 grid has sixteen. Each family is one slot in the grille, and to make a valid grille you punch out exactly one cell from each family.

Why exactly one? Because then, as you turn the grille through its four positions, the four cells of every family are each exposed once and only once. No cell is ever covered for all four turns (which would leave it blank), and no cell is exposed twice (which would overwrite a letter). One hole per family is precisely the condition that lets the four turns fill the grid completely and without collision.

Building the grille from a keyword

Historically the sender and receiver shared a physical grille, or a written description of which cells were holes. This tool builds the grille from a keyword instead, so it is easy to remember, easy to share, and always reproduces the same pattern. Each letter of the keyword is read in turn and used to choose which of the four cells in a family is punched out, family by family. If the keyword is shorter than the number of families, it simply repeats.

Because the keyword only ever selects one cell per family, every keyword automatically produces a valid grille — there is no way to type a keyword that breaks the cipher. Change a letter and you change a hole; change the grid size and the whole pattern is rebuilt for the new number of families. The diagram on the page draws the resulting grille so you can see exactly which cells are open before you turn it.

How the turning grille cipher works

Encoding proceeds turn by turn. With the grille in its starting position, write the first letters of the message into the cells showing through the holes, taking them in reading order — left to right along each row, top to bottom. Turn the grille a quarter-turn clockwise and write the next letters through the holes in their new places. Turn again, write again, and once more, four positions in all, and the grid is full. If the message is shorter than the grid, the remaining cells are filled with the padding letter X so the grid is always complete; if it is longer, a fresh grid is started and the same grille is used again.

The diagram above shows both halves of the picture. On the left is the grille in its starting position, with the punched holes marked. On the right is the finished grid, every cell coloured by the turn on which it was written — first turn, second, third, fourth — so you can watch the message spiral into place. Reading that grid straight across, row by row, gives the cipher text shown in the output.

A worked example

Take the cipher's own name, FLEISSNERGRILLE, fifteen letters, on a 4×4 grid. Suppose the grille's holes, before any turning, are at row 2 columns 3 and 4, row 3 column 4, and row 4 column 1. Writing the first four letters F, L, E, I through those holes in reading order, then turning the card clockwise and writing S, S, N, E, then R, G, R, I, then L, L, E and a padding letter, fills all sixteen cells.

Now read the finished grid straight across, row by row, and it spells SLLRGEFLRISEINE — an anagram of the original, because a transposition only rearranges. To decode, you lay the very same grille back over those letters and read through the holes in the same four-turn order, and FLEISSNERGRILLE comes back out. This is the classic illustration of the cipher; in the tool, the grille is built for you from your keyword and the grid size you choose.

Decoding a turning grille message

Decoding is the mirror image of encoding. Write the cipher text into an empty grid, row by row, until it is full. Then lay the same grille over it and read the letters showing through the holes in reading order, turn the grille a quarter-turn, read again, and continue for all four turns. The letters come out in their original order, restoring the message.

For this to work the two sides must agree on three things: the same grid size, the same grille — here, the same keyword — and the same direction of turn. This tool turns the grille clockwise throughout, both to encode and to decode, so a message made here always decodes here. Because the cipher only moves letters, anything that is not a letter in the original — spaces, digits, punctuation — is dropped before encoding and will not reappear, and any padding X added to complete the final grid will show up at the end of the decoded text.

History, uses, and security

Grille ciphers are old: Gerolamo Cardano proposed a simple grille for concealed writing in the sixteenth century, and the turning grille that fills a whole grid was set out by Fleissner in the nineteenth. Germany issued turning grilles to its forces in 1916 under code names by size — the 5×5 was Anna, the 6×6 Berta, the 8×8 Dora, and so on — but they lasted only a few months in the field before French cryptanalysts, led by Georges Painvin, broke them. Today the turning grille lives on mainly as a puzzle and a vivid lesson in how transposition works.

By modern standards it offers very little security. A transposition keeps the original letters, so the cipher text has exactly the same letter frequencies as the plain text, and an attacker who guesses the grid size has only a limited number of grilles to try, especially on a small grid. Multiple messages of the same length on the same grille are particularly revealing. Enjoy the turning grille for its history and its satisfying mechanism, and use it for games and learning — but never to protect real secrets, where a modern, peer-reviewed algorithm such as AES is the right choice.

Frequently asked questions

What is the turning grille cipher?
It is a transposition cipher that scrambles the order of a message's letters using a turning grille — a square card with holes cut in it. You write the message through the holes, turn the card a quarter-turn, and write again, four times in all, until the grid is full. Reading the grid row by row gives the cipher text. Every letter is kept; only the order changes.
What is a Fleissner grille?
The Fleissner grille is the most common turning grille, named after Eduard Fleissner von Wostrowitz, who described it in 1881. It is a square grille that, turned through four positions, fills an entire square grid. The German army used Fleissner grilles on the Western Front in 1916. Turning grille and Fleissner grille usually refer to the same cipher.
How does the keyword build the grille?
The grid's cells fall into families of four that rotate into one another, and a valid grille punches exactly one hole from each family. This tool reads the keyword letter by letter and uses each letter to choose which cell of a family is the hole. Because it always picks one cell per family, every keyword gives a working grille, and the same keyword and grid size always give the same grille.
What grid sizes can I use?
You can choose a 4×4, 6×6, or 8×8 grid. The sides must be even so the grid has no centre cell, which no rotation could move. A 4×4 grid handles sixteen letters per grid, a 6×6 handles thirty-six, and an 8×8 handles sixty-four. Messages longer than one grid are split into successive grids that all use the same grille.
Can you show a worked example?
On a 4×4 grid with holes at row 2 columns 3 and 4, row 3 column 4, and row 4 column 1, the word FLEISSNERGRILLE is written four letters at a time, turning the grille clockwise between each, and the finished grid reads SLLRGEFLRISEINE — an anagram, since a transposition only rearranges letters. Laying the same grille back over it recovers FLEISSNERGRILLE.
How do I decode a turning grille message?
Write the cipher text into an empty grid row by row, lay the same grille over it, and read the letters through the holes in reading order, turning the grille a quarter-turn between each of the four positions. In this tool, choose Decode and enter the same keyword and grid size that were used to encode. The cipher turns the grille clockwise both ways, so a message made here decodes here.
Why does my decoded text have extra X letters?
The grille has to fill the whole grid on every turn, so when a message is shorter than the grid the leftover cells are padded with the letter X. That padding becomes part of the cipher text and reappears at the end of the decoded message. You can simply ignore any trailing X letters; the rest is your original text.
Does it handle spaces, numbers, and punctuation?
No — the turning grille is a letters-only cipher, so spaces, digits, and punctuation are removed before encoding and do not come back when you decode. Only the letters A to Z take part. This is the usual convention for the cipher and keeps the grid filled with letters that can be cleanly scrambled and unscrambled.
How is it different from a columnar or scytale transposition?
All three only reorder letters, but they reorder them differently. A columnar transposition writes the text into rows and reads it out in a keyed column order; a scytale reads a fixed grid straight down its columns. The turning grille scatters letters across the grid through a rotating set of holes, which mixes neighbouring letters far more than a simple column read does.
Is the turning grille cipher secure?
No. Because it is a transposition, the cipher text has the same letter frequencies as the plain text, and once the grid size is guessed the number of possible grilles is limited, especially on small grids. French cryptanalysts broke the German grilles within months in 1916. It is wonderful for puzzles and for learning how transposition works, but for real protection use a modern algorithm such as AES.
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, keyword, and grid size in the part of the URL after the # symbol, 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

Rail Fence Cipher

Columnar Transposition Cipher

Scytale Cipher

Caesar Cipher

Vigenère Cipher

Atbash Cipher