📊 Columnar Transposition Cipher

Encrypt and decrypt text with the columnar transposition cipher. Write text into rows and read columns in key-defined order.

About the Columnar Transposition Cipher

The columnar transposition cipher is a classical transposition cipher. The plaintext is written row by row into a grid whose width equals the key length. The columns are then read off in the alphabetical order of the key's letters, producing the ciphertext. Unlike substitution ciphers, no letter is replaced — only its position changes. This tool runs entirely in your browser — nothing is uploaded.

How it works

  • Number the columns — Assign each column a rank based on the alphabetical order of the corresponding key letter (ties broken left to right).
  • Encrypt — Fill the grid row by row with the plaintext, then read columns from lowest rank to highest, top to bottom each.
  • Decrypt — Work out how many characters belong to each column (the last row may be incomplete), refill the columns in ranked order, then read the grid row by row.
  • Only letters A–Z are processed; other characters are removed before encryption.

Use cases

  • Studying transposition ciphers and how they differ from substitution.
  • Combining with a substitution cipher to build a product cipher.
  • Creating puzzles that scramble letter positions without changing the alphabet.
  • Demonstrating how column order changes the apparent randomness of text.

Frequently asked questions

Is columnar transposition secure? Alone, no. It can be broken with anagramming and pattern attacks. It becomes stronger when combined with substitution.

What if the key has duplicate letters? Ties are broken by position — the leftmost duplicate gets the lower rank.

Why are spaces and punctuation removed? Because the cipher rearranges letters, keeping non-letters would leak the column structure. This tool strips them for a clean output.

Does this tool upload my text? No. All encryption and decryption happens locally in your browser.