Columnar Transposition Cipher

Write in rows, read columns by keyword alphabetical order — keyword permutation cipher.

Plaintext
Ciphertext
Enter plaintext and set a keyword.

How to Use the Columnar Transposition Tool

  1. Enter a keyword — type any word and click Apply (e.g., ZEBRA, SECRET, KEY).
  2. Choose Encrypt or Decrypt — select the direction.
  3. Enter your text — spaces and punctuation are removed automatically.
  4. View the result — ciphertext appears on the right.
  5. Step-by-Step — click to see the columnar grid with column reading order highlighted.

About Columnar Transposition

Columnar transposition is one of the most widely used historical transposition ciphers. The plaintext is written left-to-right in rows under a keyword. The keyword letters are numbered in alphabetical order, and the columns are then read out in that numerical order to produce the ciphertext. For example, with keyword ZEBRA (Z=5, E=1, B=2, R=3, A=4), the columns are read in the order E, B, R, A, Z — that is, column 2 first, then 3, then 4, then 5, then 1.

The Encryption Algorithm

Step 1: Write out the plaintext (stripped of spaces and punctuation) in rows, with as many columns as the keyword length. If the last row is incomplete, pad with X. Step 2: Number each column by the alphabetical position of the keyword letter above it. Step 3: Read each column from top to bottom, in the order determined by the column numbers (1, 2, 3...). Concatenate these column readings to form the ciphertext.

Decryption Algorithm

Decryption reverses the process. Given the ciphertext and keyword: calculate the number of rows and which columns are shorter (if the last row is incomplete). Place the ciphertext characters back into columns in the same order used for encryption. Finally, read the grid row by row to recover the plaintext. This tool handles all padding automatically.

Historical Significance

Columnar transposition was used by many military organizations throughout the 19th and 20th centuries. The Union Army used a variant during the American Civil War. The German Army used double columnar transposition in WWI — applying the cipher twice with two different keywords — making it one of the most secure field ciphers of that era. The ADFGVX cipher combined a Polybius square substitution with a single columnar transposition. Various navies and intelligence services used columnar transposition through WWII, often combined with substitution. The cipher was eventually replaced by machine ciphers (like Enigma) and later by electronic encryption systems.

Double Transposition

Single columnar transposition can be broken by experienced cryptanalysts using column anagramming — trying different column orderings until readable text emerges. Double transposition (applying the cipher twice with different keys) is significantly stronger: the second transposition shuffles the column groups from the first transposition, creating a much more complex permutation that resists anagramming attacks. Double transposition was considered highly secure for manual cipher work and was used for the most sensitive communications in the field.

Frequently Asked Questions

Columnar transposition is a cipher where plaintext is written in rows under a keyword, then columns are read in the alphabetical order of the keyword letters. The keyword determines which column is read first, second, etc.
Number each keyword letter by its alphabetical rank (A=1, Z=last). Columns are read in ascending order of these numbers. Duplicate letters are numbered left to right. For ZEBRA: Z=5, E=1, B=2, R=3, A=4, so read columns in order 5→1→2→3→4.
Incomplete last rows are padded with X. Some columns will be one character shorter than others. Both sender and receiver must use the same padding convention to decrypt correctly.
Single columnar transposition preserves letter frequencies and can be broken by column anagramming. Double transposition (applied twice with different keys) is significantly stronger and was used militarily for sensitive communications.
Double transposition applies columnar transposition twice with two different keywords. It was used by the German Army in WWI and by several militaries in WWII as a strong field cipher for top-secret communications.