Encrypt with the keyword ZEBRAS
WE ARE DISCOVERED. FLEE AT ONCE.
EVLNACDTESEAROFODEECWIREE
ZEBRAS ranks its letters A=1, B=2, E=3, R=4, S=5, Z=6, so the 5th column is read first.
Write the message in rows under a keyword and read the columns in alphabetical order of the key. See the grid as you type, use a word or a number key, or let the solver find the key.
Grid
Key guesses
3 1 2.WE ARE DISCOVERED. FLEE AT ONCE.
EVLNACDTESEAROFODEECWIREE
ZEBRAS ranks its letters A=1, B=2, E=3, R=4, S=5, Z=6, so the 5th column is read first.
EVLNACDTESEAROFODEECWIREE
WEAREDISCOVEREDFLEEATONCE
25 letters in 6 columns: the first column has 5 letters and the others 4, which decryption works out from the length.
HELLOWORLD
EORLWLHLOD
Column 2 (numbered 1) is read first, then column 3, then column 1.
A columnar transposition writes the message in rows of a fixed width under a keyword, then reads the columns one after another in the alphabetical order of the keyword's letters. The letters do not change, only their order. It was widely used, often applied twice ("double transposition"), into the Second World War.
With the keyword ZEBRAS, the letters are ranked alphabetically: A = 1, B = 2, E = 3, R = 4, S = 5, Z = 6. The message WEAREDISCOVEREDFLEEATONCE is written in rows of 6:
Z E B R A S6 3 2 4 1 5-----------W E A R E DI S C O V ER E D F L EE A T O N CEReading the columns in order 1 to 6 gives EVLN + ACDT + ESEA + ROFO + DEEC + WIREE = EVLNACDTESEAROFODEECWIREE.
When a keyword has a repeated letter, the repeats are ranked from left to right. A number key such as 3 1 2 gives the reading order directly.
If the last row is not full, there are two options. A regular transposition pads the last row with filler letters (often X), so every column has the same length. An irregular transposition leaves the gaps, so some columns are one letter longer. To decrypt an irregular transposition, work out the column lengths from the message length: with 25 letters and 6 columns, the first column has 5 letters and the others 4.
For short keys, every column order can be tried: 6 columns have 720 orders. The solver here tries every key from 2 to 6 columns (873 in total) and ranks each result by how often common English letter pairs such as TH and HE appear. For longer keys, codebreakers use "anagramming": they line up columns side by side and look for pairs that form common English pairs and words.
Both are transposition ciphers. The rail fence cipher follows a fixed zigzag, and its only key is the number of rails, so it has very few keys. Columnar transposition uses a keyword, so the number of possible keys grows fast: a 10-letter key has 3,628,800 column orders.
Columnar transposition is not secure today. Even double transposition, a strong hand cipher, can be broken by computer.
function columnar(text, key) { const k = key.length; const order = [...key].map((c, i) => [c, i]).sort().map(([, i]) => i); const cols = Array.from({ length: k }, () => ''); [...text].forEach((ch, i) => { cols[i % k] += ch; }); return order.map((i) => cols[i]).join('');} columnar('WEAREDISCOVEREDFLEEATONCE', 'ZEBRAS'); // "EVLNACDTESEAROFODEECWIREE"The result differs from another tool
Check three things: whether spaces are removed (Letters only), whether the last row is padded (Pad), and how repeated key letters are ranked. This tool ranks repeats from left to right.
Decrypting a padded message leaves X letters at the end
Padding letters are part of the ciphertext. Remove the trailing filler after decrypting.
The solver does not find my key
The solver only tries keys up to 6 columns. Longer keys need the keyword, or manual anagramming of the columns.
Each letter of the keyword is ranked alphabetically, and the columns are read from rank 1 upwards. In ZEBRAS, the column under A is read first and the column under Z last.
Yes. Type numbers such as 3 1 2 (or 312): the column with the smallest number is read first.
Applying a columnar transposition twice, usually with two different keys. It is much stronger than a single transposition and was used by several armies in both World Wars.
For keys up to 6 columns, choose Decrypt and read Key guesses: every order is tried and ranked by English letter pairs. Click a key to apply it.
No. Everything runs in your browser.
Free, private developer tools that run in your browser. No signup, nothing uploaded, no waiting.
Tip: press Ctrl D to bookmark dev247.