Route Cipher
Write your message into a grid row by row, then read it back along a route — a spiral, down the columns, a zigzag through the rows. Choose the grid width, the route and the starting corner, move letters or whole words, and see each cell numbered in reading order. Free, no sign-up.
The message is written into rows this wide (2–60). Width, route and corner are the whole key.
A short last row is simply skipped by the route. Filling makes the grid a full rectangle; the X stays in the decoded text.
Whatever you keep is written into the grid like a letter; anything else is removed before the message is laid out. Whole words move as they are.
The grid and the route
The message is written into the grid row by row. The route then visits the cells in the order numbered below; the first cell is blue and the last is amber.
5 rows of 5 columns.
| Column 1 | Column 2 | Column 3 | Column 4 | Column 5 | |
|---|---|---|---|---|---|
| Row 1 | W | e | a | r | e |
| Row 2 | d | i | s | c | o |
| Row 3 | v | e | r | e | d |
| Row 4 | f | l | e | e | a |
| Row 5 | t | o | n | c | e |
Reading order
The number in each cell is the step at which the route reads it.
| Column 1 | Column 2 | Column 3 | Column 4 | Column 5 | |
|---|---|---|---|---|---|
| Row 1 | 1 | 2 | 3 | 4 | 5 |
| Row 2 | 16 | 17 | 18 | 19 | 6 |
| Row 3 | 15 | 24 | 25 | 20 | 7 |
| Row 4 | 14 | 23 | 22 | 21 | 8 |
| Row 5 | 13 | 12 | 11 | 10 | 9 |
How to Use the Route Cipher
- 1. Choose the key. The key is three decisions: how many columns wide the grid is, which route reads it, and which corner the route starts in. The reader needs all three.
- 2. Pick what moves. Letters are moved one by one, with spaces and punctuation removed unless you tick them. Whole words keep each word intact and move it as a single cell, as the Union Army's route ciphers did.
- 3. Encode or decode. Encode writes your message into the grid and gives the route reading. Decode lays the cipher text along the same route and reads the grid row by row. Tick Try every grid width in Decode mode if you do not know the width.
- 4. Check the grid. The first table is the message as written, the second numbers each cell by the step at which the route reaches it. Blue marks the first cell, amber the last.
How a Route Cipher Works
A route cipher is a transposition: it changes where the letters are, never what they are. The message is written into a rectangle one row at a time, left to right. Then it is copied out by walking a path — the route — through the rectangle. Only someone who knows the width of the grid and the route can walk it backwards.
Take WE ARE DISCOVERED FLEE AT ONCE, which is 25 letters, and a grid 5 columns wide. It fills a 5 × 5 square:
The message in a 5-column grid
W E A R E D I S C O V E R E D F L E E A T O N C E
Start in the top-left corner and spiral clockwise toward the middle: along the top row, down the right edge, back along the bottom, up the left edge, then round again inside. The cipher text is WEAREODAECNOTFVDISCEEELER. The tool numbers the cells so you can follow the path with your finger.
The same grid, other routes
| Route (start top left) | Cipher text |
|---|---|
| Spiral inward, clockwise | WEAREODAECNOTFVDISCEEELER |
| Spiral inward, counter-clockwise | WDVFTONCEADOERAEIELEEECSR |
| Column by column | WDVFTEIELOASRENRCEECEODAE |
| Columns, zigzag | WDVFTOLEIEASRENCEECREODAE |
| Rows, zigzag | WEAREOCSIDVEREDAEELFTONCE |
Starting in another corner, or reading the route backwards from its last cell, gives still more. Reading a spiral backwards starts in the middle and works outward. Plain rows from the top left do nothing at all, since that is how the grid was written.
What happens when the message does not fill the grid
The last row is usually short. This tool lets the route step over the empty cells, so the cipher text is exactly as long as the message and the receiver rebuilds the same grid from the length and the width alone. If you prefer a full rectangle, tick the fill option and the empty cells become X, which you remove by hand after decoding.
Word Routes in the American Civil War
Route ciphers were used on a large scale by the Union Army in the American Civil War. The system associated with Anson Stager, a telegraph executive in Ohio, wrote a message into a grid with one word in each cell and copied the words out along a route, rather than moving single letters. Operators also swapped codewords in for names and places and inserted meaningless filler words, called nulls, so that the true shape of the grid was hidden. The opening words of a message told the receiver which route to use. Choose Whole words here to see the transposition part of such a system; the codewords and nulls are separate steps this tool does not perform.
Word routes are harder to read casually than letter routes, because a codebreaker sees real words in the wrong order rather than gibberish. But a cipher of this kind falls to the same attack as any transposition: guess the grid, try the routes, and look for a reading that makes sense.
Breaking a Route Cipher
The key space is small. A message of n letters can only sit in a grid with 2 to n − 1 columns, and there are a handful of routes and four corners. The Try every grid width option decodes with each width along the route you have chosen and ranks the results by how many common English letter pairs and triples they contain. A spiral shuffles less thoroughly than a column read, so a wrong width can look fairly English; read the top few lines rather than trusting the first.
Because a transposition only moves letters, the letter counts of the cipher text match those of ordinary language. If a frequency count of the cipher text looks like English but the text is unreadable, suspect a transposition such as this one, a scytale or a rail fence. Combining it with a substitution — substitute first, then route — hides that clue, and is the idea behind stronger classical systems.
Frequently Asked Questions
- What is a route cipher?
- A transposition cipher in which the message is written into a grid and then read out along an agreed route, such as a spiral or a zigzag. The letters stay the same; only their order changes. The key is the grid width plus the route.
- How do you decode a route cipher?
- Build the same empty grid, walk the route, and put the cipher text into the cells in the order the route visits them. Then read the grid row by row. Choose Decode and enter the same width, route and corner as the sender, or tick Try every grid width if you only know the route.
- What is a spiral cipher?
- A route cipher whose route is a spiral: you start in a corner and move around the edge of the grid, turning at each wall, until you reach the middle. It can run clockwise or counter-clockwise from any of the four corners.
- How is a route cipher different from columnar transposition?
- In columnar transposition a keyword decides the order in which whole columns are read, always top to bottom. A route cipher has no keyword: the order comes from a path through the grid, which can turn corners, spiral or zigzag. The scytale is the simplest case, reading columns in order.
- What are nulls in a route cipher?
- Nulls are meaningless letters or words added to fill the grid or disguise its shape. The Union Army's word route ciphers used null words extensively. This tool offers a plain X filler for a full rectangle but does not insert hidden nulls.
- Is a route cipher secure?
- No. A 25-letter message has fewer than a thousand possible keys, and a letter route leaves letter frequencies unchanged. It is useful for teaching and puzzles, but modern encryption is the answer for anything private.
- Why does my decoded text have extra letters at the end?
- The message was probably padded to fill the grid. Decode with the width and route used to encode, then remove the padding letters, usually X, by hand. If the text looks scrambled instead, check that the corner, direction and spaces option match.