Columnar Transposition Cipher Examples & Tutorials

Learn columnar transposition cipher with step-by-step examples covering encryption, decryption, double transposition, and keyword handling.

Step-by-Step: Keyword ZEBRAS

Encrypt "WE ARE DISCOVERED FLEE AT ONCE"

Step 1: Determine Column Order

Sort the keyword letters alphabetically. Each letter's position in the sorted order becomes its column number.

KeywordZEBRAS
SortedABERSZ
Column #632415

Step 2: Fill the Grid Row by Row

Write the plaintext into a grid with 6 columns (one per keyword letter). Pad the last row with X.

ZEBRAS
632415
WEARED
ISCOVE
REDFLE
EATONC
EXXXXX
Reading order: ABERSZ

Step 3: Read Columns in Order

Read each column top-to-bottom, following the numbered order (1st, 2nd, 3rd...).

#1 (A)EVLNX
#2 (B)ACDTX
#3 (E)ESEAX
#4 (R)ROFOX
#5 (S)DEECX
#6 (Z)WIREE
Ciphertext
EVLNXACDTXESEAXROFOXDEECXWIREE
1. What is the column order for keyword "KEY"?
2. Encrypt "HELLO WORLD" with keyword "ABC"
3. Why is double transposition more secure than single?

Frequently Asked Questions About Columnar Transposition Examples

How does the basic ZEBRAS example work?

The basic example encrypts "WE ARE DISCOVERED FLEE AT ONCE" with the keyword ZEBRAS. Step 1 sorts the keyword letters alphabetically (A, B, E, R, S, Z) to determine the column reading order. Step 2 writes the plaintext into a six-column grid row by row, padding the last row with X. Step 3 reads each column top-to-bottom following the numbered order, producing the ciphertext. The interactive grid color-codes columns so you can trace exactly which letters end up where.

Why does the double transposition example use two keywords?

Double transposition encrypts the message twice with two different keywords (SECRET then CODE in the example). The first pass produces an intermediate ciphertext that is fed into the second pass. Because the second pass scrambles the column structure of the first pass, anagramming attacks become much harder. The German military used double transposition extensively during both World Wars for exactly this reason.

What does the WWII usage example teach?

The WWII example compares single versus double transposition across security level, typical usage, key options versus rail fence, and equipment requirements. It explains why a pencil-and-paper cipher with memorized keywords was attractive for field operatives, and notes that the German ADFGVX cipher combined Polybius square substitution with columnar transposition. British cryptanalyst Georges Painvin broke ADFGVX in June 1918.

How do the practice questions help me learn?

The practice section asks you to determine the column order for keyword KEY, encrypt HELLO WORLD with keyword ABC, and explain why double transposition is more secure than single. Click reveal to see the worked answers. Doing the questions first and then checking is the fastest way to confirm you can apply the keyword sorting and column reading rules by hand without depending on the encoder tool.

Columnar Transposition Cipher Examples - Learn Step by Step

Master the columnar transposition cipher through detailed, hands-on examples covering encryption, decryption, double transposition, and cryptanalysis. Each example shows every step of the process, from keyword ordering to grid construction and column reading. All examples can be verified using our columnar transposition encoder and decoder.

Example 1: Basic Encryption with Keyword ZEBRAS

This classic example demonstrates the standard columnar transposition process using the well-known keyword ZEBRAS.

Problem Setup

Plaintext: WE ARE DISCOVERED FLEE AT ONCE Keyword: ZEBRAS

Step 1: Determine column order

Sort the keyword letters alphabetically, breaking ties by position:

LetterZEBRAS
Position012345
Order632415

Alphabetical ranking: A(pos 4)=1, B(pos 2)=2, E(pos 1)=3, R(pos 3)=4, S(pos 5)=5, Z(pos 0)=6

Step 2: Write plaintext into the grid

Remove spaces and write row by row into 6 columns:

Z(6)E(3)B(2)R(4)A(1)S(5)
WEARED
ISCOVE
REDFLE
EATONC
EXXXXX

Last row padded with X.

Step 3: Read columns in order 1, 2, 3, 4, 5, 6

  • Column 1 (A): EVLNX
  • Column 2 (B): ACDTX
  • Column 3 (E): ESEAX
  • Column 4 (R): ROFOX
  • Column 5 (S): DEECX
  • Column 6 (Z): WIREE

Result: WE ARE DISCOVERED FLEE AT ONCE -> EVLNXACDTXESEAXROFOXDEECXWIREE

Example 2: Basic Decryption

Decrypt the ciphertext from Example 1 back to the original message.

Problem Setup

Ciphertext: EVLNXACDTXESEAXROFOXDEECXWIREE Keyword: ZEBRAS

Step 1: Calculate grid size

30 characters / 6 columns = 5 rows (exact fit, no short columns)

Step 2: Fill columns in alphabetical order

Each column gets 5 characters. Fill in order 1, 2, 3, 4, 5, 6:

Column 1 (A, position 4): E V L N X Column 2 (B, position 2): A C D T X Column 3 (E, position 1): E S E A X Column 4 (R, position 3): R O F O X Column 5 (S, position 5): D E E C X Column 6 (Z, position 0): W I R E E

Step 3: Reconstruct grid with columns in original positions

Z(0)E(1)B(2)R(3)A(4)S(5)
WEARED
ISCOVE
REDFLE
EATONC
EXXXXX

Step 4: Read row by row

WEAREDISCOVEREDFLEEATONCEXXXXX

Remove padding: WE ARE DISCOVERED FLEE AT ONCE

Example 3: Short Keyword Encryption

A shorter keyword creates fewer columns, producing a different grid structure.

Problem Setup

Plaintext: ATTACK AT DAWN Keyword: KEY

Step 1: Column order

KEY
213

Alphabetical: E=1, K=2, Y=3

Step 2: Fill the grid (removing spaces)

K(2)E(1)Y(3)
ATT
ACK
ATD
AWN

No padding needed (12 characters / 3 columns = 4 rows exactly).

Step 3: Read in order 1, 2, 3

  • Column 1 (E): TCTW
  • Column 2 (K): AAAA
  • Column 3 (Y): TKDN

Result: ATTACK AT DAWN -> TCTWAAAATKDN

Example 4: Double Columnar Transposition

Double transposition applies two rounds of encryption for significantly stronger security.

Problem Setup

Plaintext: HELLO WORLD First keyword: CAB Second keyword: DUSK

Step 1: First encryption with keyword CAB

Column order: A=1, B=2, C=3

C(3)A(1)B(2)
HEL
LOW
ORL
DXX

Padded with X. Read columns: EORX LWLX HLOD

First pass result: EORXLWLXHLOD

Step 2: Second encryption with keyword DUSK

Column order: D=1, K=3, S=2, U=4

Wait -- sorted alphabetically: D=1, K=2, S=3, U=4

D(1)U(4)S(3)K(2)
EORX
LWLX
HLOD

Read columns in order 1, 2, 3, 4: ELH XXD RLO OWL

Final ciphertext: ELHXXDRLOOWL

Double Transposition Decryption

To decrypt, reverse the process: first undo keyword DUSK, then undo keyword CAB.

Example 5: Handling Repeated Letters in Keyword

When a keyword has repeated letters, ties are broken by position (left to right).

Problem Setup

Plaintext: SECRET Keyword: BANANA

Step 1: Column order with repeated letters

BANANA
215364

Three A's: first A (position 1) = rank 1, second A (position 3) = rank 3, third A (position 5) = rank 4. Two N's: first N (position 2) = rank 5, second N (position 4) = rank 6. One B: B (position 0) = rank 2.

Step 2: Fill the grid

B(2)A(1)N(5)A(3)N(6)A(4)
SECRET

Only one row needed for 6 characters.

Step 3: Read in order 1, 2, 3, 4, 5, 6

E S R T C E

Result: SECRET -> ESRTCE

Frequently Asked Questions

Where can I find columnar transposition examples with solutions?

This page provides comprehensive columnar transposition examples with complete step-by-step solutions covering basic encryption and decryption, short keywords, double transposition, and handling repeated keyword letters. All examples include grid visualizations and can be verified using our encoder and decoder tools.

How to solve columnar transposition step by step?

To encrypt: write your keyword, number columns alphabetically, fill plaintext into the grid row by row (padding if needed), then read columns in numbered order. To decrypt: calculate grid dimensions, fill columns in alphabetical order with ciphertext segments, then read the grid row by row. See Examples 1 and 2 above for complete walkthroughs.

How does double columnar transposition work?

Encrypt the message with the first keyword as normal, then take the resulting ciphertext and encrypt it again with a second keyword. For decryption, reverse the process: decrypt with the second keyword first, then decrypt that result with the first keyword. Example 4 above demonstrates this complete process.

How do repeated letters in the keyword affect encryption?

When a keyword contains repeated letters (like BANANA), ties are broken by position from left to right. The first occurrence of a letter gets the lower rank. This ensures a unique, deterministic column order regardless of letter repetition. See Example 5 for a demonstration.

What padding character should I use?

The most common padding characters are X and Z because they are the least frequent letters in English. Some implementations use random letters or no padding at all. The choice of padding character does not affect security but can make manual decryption easier if a recognizable character is used.