Skip to content

How the Scytale Cipher Works: A Secret Wrapped Around a Stick

Write along a rod, unwind the strip, and the letters change places. A worked example shows how to put them back—and where the history gets less certain.

Try the Scytale Cipher tool
A scytale rod with letters written along it, and the coloured strip unwound into ciphertext
The message runs along the rod. Unwind the strip, and the same letters appear in a different order. Open full-size ↗

Imagine a messenger arriving at a Spartan camp with what looks like a strip of leather from a belt. The letters make no sense until the commander winds the strip round a wooden staff. As the edges meet, the jumble becomes a message. Somewhere back in Sparta is a matching staff.

That scene is a reconstruction, not something we can verify from a surviving Spartan dispatch. But the idea behind it is easy to try. A scytale (roughly SKIT-uh-lee) hides the order of a message rather than replacing its letters. Caesar shifts one letter into another; the scytale just moves it. That makes it a transposition cipher.

How the rod and strip work

Wind a narrow strip of paper round a pencil in a spiral, with the edges meeting. Each complete wrap is a turn. Now write a line along the pencil, crossing from one turn to the next. Rotate the pencil and write the next line. Each line is a row running the length of the rod.

In the tool, each turn holds one letter from each row. If four letters fit around the rod, it has four rows. We call that count the circumference. It is a number of letters per turn, not a measurement in centimetres, and it is the key in this digital model. The physical version also depends on how the strip is wound and aligned.

Side and end views of a wound scytale strip, with four letters around each turn
The side view shows the turns along the rod. The end view shows four letters around one turn, so the circumference is 4. Open full-size ↗

Encode a message

Take the textbook example I am hurt very badly help. In letters-only mode it becomes IAMHURTVERYBADLYHELP. That is 20 letters, so a circumference of 4 gives five turns. Write the first five letters along row 1, the next five along row 2, and so on.

Row 1   I A M H U
Row 2   R T V E R
Row 3   Y B A D L
Row 4   Y H E L P

Unwind the strip and read from its start. You meet the four letters that were on the first turn, IRYY, then the four from the second, ATBH. The other turns give MVAE, HEDL and URLP. Together they make the ciphertext IRYYATBHMVAEHEDLURLP.

Three illustrated steps: write along the rod, unwind the strip, and read it in ciphertext order
Write along the rod, unwind the strip, then read from end to end. Each colour marks a turn. Open full-size ↗

You can do the same thing on squared paper. The wrapped surface becomes a grid: rows run along the rod and columns stand for turns of the strip. Encoding is the difference between two routes through that grid: write across the rows, then read down the columns.

Four rows and five turns mapped to the 20 ciphertext positions
Fill the grid across the rows, then read down each column. The four letters in each column sit together on the unwound strip. Open full-size ↗

Wind it back to decode

To decode, wind the ciphertext back onto a rod of the same circumference. In the grid, that means putting IRYY down the first column and ATBH down the next, until the strip runs out. Read across the rows to get IAMHURTVERYBADLYHELP again. You can put the spaces back by eye, but letters-only encoding didn’t save them.

There is a shortcut if you have the strip but no rod. For circumference 4, row 1 is made of strip positions 1, 5, 9, 13, 17. Row 2 starts at position 2 and takes every fourth letter from there. Repeat for rows 3 and 4, then join the rows. These positions start at 1, just like the tool’s labels.

Winding ciphertext back onto the rod, including a short final turn
Wind the strip back on to recover the rows. In the short example, dashed cells are bare rod, not missing letters. Open full-size ↗

When the last turn is short

SENDMORETROOPS has 14 letters. At circumference 4, three full turns use 12 letters; the last two reach only the first two rows. That gives rows SEND, MORE, TRO and OPS. Read the columns as before and you get SMTOEORPNROSDE. On the way back, the decoder uses the strip’s length to work out which rows get the extra letter. The two dashed cells in the diagram never held any text.

Padding is optional. Fill the last turn with X appends two Xs to the plaintext before arranging it, giving SMTPEORSNROXDEOX. Decoding returns SENDMORETROOPSXX. The tool leaves the extra letters in place: it can’t tell padding apart from a real X at the end of a message.

The maths behind the strip

Number rows, turns and strip positions from 0 for this part. If a letter is in row r on turn t and the circumference is c, its strip position is k = t × c + r. To go back, divide k by c: the remainder gives the row and the whole-number quotient gives the turn. In the 20-letter example, V is in row 1 on turn 2, so its strip index is 2 × 4 + 1 = 9. That’s the tenth letter.

The remainder also explains the uneven grid. Write the message length as n = q × c + m, where q is the number of full turns and m is the number of letters left over. The first m rows have q + 1 letters; the rest have q. It’s the same rule for the 20-letter example (remainder 0) and the 14-letter one (remainder 2).

Why the key is easy to guess

The ciphertext tells you how many letters are on the strip. In this model, circumference 1 leaves the text unchanged because there’s only one row. Circumferences at least as large as the message also leave it unchanged because all the letters fit in one turn. The remaining candidates run from 2 to n − 1: only 18 settings for our 20-letter example.

The same ciphertext on rods of circumference 3, 4 and 5, with only 4 restoring the message
The same strip at circumferences 3, 4 and 5. Only 4 restores this message. Open full-size ↗

Try those widths in turn. At 3 the result is IYBVHLLRAHAEUPYTMEDR; at 5 it is ITALRBEUYHHRYMELAVDP. At 4, the words stand out. That isn’t guaranteed for every message: different widths can give the same reading, and very short results can look plausible more than one way. The point is how few possibilities there are to check.

All 18 candidate readings for the example ciphertext, with circumference 4 highlighted
All 18 candidate circumferences for the worked example. The reading at circumference 4 stands out. Open full-size ↗

Counting individual letters won’t select the right width: all the candidates have the same counts. Recognisable words and letter pairs are more useful because they depend on order. A plausible tally can be a clue, but it doesn’t establish that a message used transposition. The scytale is a good puzzle and a poor way to protect private text.

Did Sparta really use it?

In Life of Lysander, chapter 19, Plutarch describes Spartan magistrates keeping one of two matching rods and giving the other to a commander. In his story, a dispatch summons Lysander home after complaints from the Persian governor Pharnabazus. Plutarch wrote centuries after the events. Earlier uses of the Greek word can refer to a staff or a dispatch without telling us how the message was written.

Aulus Gellius, another later author, describes writing across the strip’s joins. Unwinding can then split individual handwritten letters, leaving fragments until the edges come together again. That’s a useful distinction: the diagrams put one intact letter in each cell, so we can follow the rearrangement. Trying 18 candidate circumferences is a demonstration of that classroom model, not a claim about how quickly someone could read an ancient strip of fragmented handwriting.

Historians disagree about what the sources establish. Thomas Kelly argued that there’s no reliable evidence for Spartan use as a cipher. Martine Diepenbroek makes the case that it was a practical device for secret communication. The mechanism works; how it was used in Sparta, and how often, are separate questions.

Scytale, Rail Fence and Columnar Transposition

These three ciphers keep the letters and change the route. The Scytale reads down the turns of the strip. Rail Fence writes in a zigzag and reads each rail in order. Columnar Transposition writes in rows under a keyword and uses that keyword to decide which column to read first, second and so on.

A comparison of Scytale, Rail Fence and Columnar Transposition using ATTACKATDAWN
Same message, three routes. The Scytale reads down each turn, Rail Fence reads each rail in order, and Columnar Transposition reads columns in key order. Open full-size ↗

For ATTACKATDAWN, the outputs are ACDTKATAWATN with Scytale circumference 3, ACDTAKTANTAW with three rails, and TKDNTCTWAAAA under the columnar keyword ROD. When the Scytale grid is full, it behaves like a columnar cipher whose columns are read straight from left to right. The keyword in Columnar Transposition lets you shuffle that order too.

Try it yourself

In the Scytale Cipher tool, choose Encode, load the example and set the circumference to 4. Press Unwind or move the slider yourself. The step-by-step grid shows which position each letter moves to; use Next to trace one letter at a time. Switch to Decode to carry the output back into the input. Change the circumference and use Try every circumference to compare readings. The tool checks candidate widths from 2 to 24, excluding widths that are at least as large as the message.

To move spaces, punctuation and case instead of stripping them, select Keep spaces, symbols & case in both modes. The tool warns if a Unicode sequence can’t be rearranged reversibly as plain text. Grouping in fives, by contrast, is just a display option for letters-only ciphertext. Copying and saving text happen in your browser.

A small Python example

This example works with letters you’ve already prepared: uppercase A–Z, no spaces and no padding. The key idea is to list the plaintext positions in the order the strip visits them. Encoding reads from those positions; decoding puts each letter back in the same position.

Python’s divmod gives the quotient and remainder together. Dividing the message length by the circumference gives the number of full turns and how many rows get an extra letter. Dividing a strip position by the same number tells you which turn and row it belongs to.

Python exampleShow code
def strip_order(length, circumference):
    if circumference < 1:
        raise ValueError("Circumference must be positive.")

    full_turns, extra_rows = divmod(length, circumference)
    for position in range(length):
        turn, row = divmod(position, circumference)
        # The first extra_rows rows each contain one more letter.
        row_start = row * full_turns + min(row, extra_rows)
        yield row_start + turn


def encode(plaintext, circumference):
    order = strip_order(len(plaintext), circumference)
    return "".join(plaintext[index] for index in order)


def decode(ciphertext, circumference):
    plaintext = [""] * len(ciphertext)
    order = strip_order(len(ciphertext), circumference)
    for letter, index in zip(ciphertext, order):
        plaintext[index] = letter
    return "".join(plaintext)


examples = [
    ("IAMHURTVERYBADLYHELP", "IRYYATBHMVAEHEDLURLP"),
    ("SENDMORETROOPS", "SMTOEORPNROSDE"),
]
for message, expected in examples:
    ciphertext = encode(message, 4)
    decoded = decode(ciphertext, 4)
    assert ciphertext == expected
    assert decoded == message
    print(f"{message} -> {ciphertext} -> {decoded}")

Both examples use circumference 4. The first makes five full turns; the second makes three full turns and stops two letters into the fourth. The same calculation handles both, without adding any Xs.

Common questions

Why does another Scytale calculator give a different result?

Check what its key counts. Our tool uses the letters per turn, which is the number of rows, not the number of turns. Also match the padding and character settings: stripping spaces or adding Xs changes the length of the message and therefore the grid.

Should I delete the Xs at the end after decoding?

Only if you know how many were added as padding. The decoder can’t distinguish padding from letters that were already in the message. If you control both ends of the experiment, leave Fill the last turn with X off to avoid the ambiguity.

Try it with a pencil

Wind paper round a pencil, write a short message along it, then hand the loose strip to someone else. With a pencil of the same thickness and the strip lined up the same way, the letters fall back into place. That’s the trick the imagined messenger was counting on: not one letter had to change.

Sources and further reading

Try the Scytale Cipher Tool

Want to experiment with the idea in practice? Open the matching tool and try your own text.

Open Scytale Cipher
Signal acquired

A note from the team

We build these tools because we love cryptography, encoding, and making difficult ideas easier to explore. If they've helped you, even a small coffee means the world to the project. Thank you!

Say thanks on Ko-fi

Read next

Transposition Rail Fence Cipher: The Zigzag That Hid the Message How one of the simplest transposition ciphers scrambled plaintext by changing where the letters sit, not what the letters are. Transposition Columnar Transposition Cipher: When the Key Rearranges the Columns How a keyword turns a message into a grid, then hides it by changing the order in which the columns are read. Cryptanalysis Frequency Analysis: The Statistical Fingerprint That Broke Classical Ciphers How counting letters turned cryptanalysis from educated guesswork into a science, and why weak ciphers still betray themselves through the shape of language.
Back to all articles