Noodler Blog

Types of Substitution Cipher, Explained

← Back to blog

A substitution cipher swaps each letter in a message for something else - another letter, a number, a symbol - following a fixed rule. That's the whole idea. The cleverness isn't in the swap itself, it's in how the rule's built, and that's what separates the different types from each other. Some are so simple you could crack one over breakfast. Others held up for centuries.

Caesar cipher

The alphabet shifted three places, so A becomes D, B becomes E, and C becomes F

The simplest version, and probably the most famous. Every letter shifts a fixed number of places through the alphabet - shift by 3 and A becomes D, B becomes E, C becomes F, and so on, wrapping round at the end so X, Y, Z become A, B, C. Named after Julius Caesar, who's said to have used a shift of 3 for his military correspondence, trusting that most of his enemies couldn't read at all, let alone crack a cipher.

It's easy to use and just as easy to break. There are only 25 possible shifts (26 minus the one that doesn't move anything), so if you suspect a message is Caesar-shifted, you can just try all of them until words appear. This is called a brute-force attack, and it's about as unsophisticated as codebreaking gets - but it works.

Atbash cipher

The alphabet mirrored end to end, so A becomes Z, B becomes Y, and M becomes N

Older than Caesar's, and mechanically even simpler. The alphabet's just reversed: A swaps with Z, B with Y, C with X, and so on down to the middle. It first appears in Hebrew texts, used to hide or stylise certain words rather than for military secrecy.

There's no key to remember, which is the appeal, but it also means there's nothing to crack - the substitution rule is completely fixed, so once you know it's Atbash, you're done. It's less a cipher for secrecy and more a bit of wordplay dressed up as one.

Monoalphabetic substitution

Ten plain letters connected by crossing lines to a scrambled set of substitute letters, with no fixed pattern

This is the general case that both Caesar and Atbash belong to. Each letter maps to exactly one other letter or symbol for the whole message, but unlike Caesar's shift or Atbash's mirror, the mapping can be anything - any scrambled arrangement of the alphabet at all.

That's the kind Quipher uses. Rather than a predictable shift you could brute-force in 25 tries, each letter's swapped for a number based on a scrambled key, so there's no shortcut through the possibilities - you have to work it out from the patterns in the text itself.

This is where frequency analysis comes in, and it's the classic way to crack monoalphabetic ciphers. In English, E is by far the most common letter, followed by T, A, O, and I. Short words are a giveaway too - a single-letter word is almost always "I" or "a," and a common three-letter word showing up repeatedly is often "the." Once you've guessed a handful of letters this way, the rest tends to fall into place, since half-solved words start suggesting the letters still missing.

Polyalphabetic substitution

The message ATTACKATDAWN shifted by the repeating keyword LEMON to produce the Vigenère-ciphered result LXFOPVEFRNHR

A proper step up in difficulty. Instead of one fixed mapping for the whole message, a polyalphabetic cipher uses several, switching between them as you go. The best-known example is the Vigenère cipher, which cycles through a set of Caesar shifts based on a repeating keyword.

Here's roughly how it works: say your keyword is "CODE." Each letter of the keyword tells you how far to shift the corresponding letter of your message - C shifts by 2, O by 14, D by 3, E by 4 - and then the pattern repeats for the next four letters, and the next, for as long as your message runs. The upshot is that the same letter in your original message can end up as a completely different symbol each time it appears, depending on where it falls against the repeating keyword.

That breaks frequency analysis almost entirely, at least at a glance - you can't just count which symbol shows up most and assume it's E, because E might be encoded five different ways across one message. For centuries the Vigenère cipher was considered close to unbreakable, and it took real mathematical insight (working out the length of the repeating keyword, then treating each position as its own smaller frequency problem) to crack it reliably.

Beyond substitution: a note on machines

The logical endpoint of "keep making the substitution more complicated" is a machine that changes its own mapping after every single letter, so no pattern ever repeats long enough to analyse. That's essentially what the Enigma machine did during the Second World War - a mechanical substitution cipher, but one that rewired itself constantly, which is why it took a dedicated codebreaking effort (and a fair bit of luck) to crack rather than just a sharp eye and some frequency tables.

Substitution vs transposition

The word HELLOWORLD written in a zigzag across three rows, then read off row by row to produce the scrambled result

Worth being clear on this distinction, since the two get mixed up. A substitution cipher changes what the letters are but keeps their order - the second letter of your message is still the second letter of the cipher, just written differently. A transposition cipher does the opposite: it keeps every letter exactly as it is, but scrambles the order they appear in. Rearrange "HELLO" into "OLLEH" and you've transposed it, not substituted it.

A simple example is a rail fence cipher, where you write your message zigzagging across a few rows, then read the rows off one at a time to get the scrambled result. No letter's been changed - "HELLO" is still made of an H, an E, two Ls, and an O - they've just been reordered. Some serious historical ciphers combined both approaches, substituting first and then transposing the result, which is considerably harder to unpick than either on its own.

Further reading

If you want to go properly deep on all this, The Code Book by Simon Singh is a brilliant read - it covers the history of cryptography from ancient ciphers right through to modern encryption, with plenty of Vigenère and Enigma along the way. It's genuinely where a lot of my own interest in this stuff comes from, and I still go back to it now and then.

Frequently asked questions

What is a substitution cipher?

A substitution cipher replaces each letter of a message with a different letter, number, or symbol according to a fixed rule — the letters' order never changes, only what stands in for them.

What's the difference between a Caesar cipher and Atbash?

A Caesar cipher shifts every letter by a fixed number of places (traditionally 3); Atbash mirrors the whole alphabet, swapping the first letter with the last, the second with the second-to-last, and so on. Both are fixed, keyless substitutions with nothing to guess once you know the rule.

What's the difference between monoalphabetic and polyalphabetic substitution?

A monoalphabetic cipher uses one fixed letter-for-letter mapping for the whole message — the kind Quipher uses. A polyalphabetic cipher, like the Vigenère cipher, switches between several mappings as it goes, which is what makes it so much harder to crack with frequency analysis alone.

What's the difference between substitution and transposition ciphers?

A substitution cipher changes what each letter is but keeps its order; a transposition cipher, like a rail fence cipher, keeps every letter as it is but scrambles the order they appear in.

Is the Enigma machine a substitution cipher?

Yes — Enigma performed a polyalphabetic substitution that changed with every keystroke via its rotors, which is what made it so much harder to break than a simple one-to-one substitution.

Quipher's built on monoalphabetic substitution - fancy name, simple idea, but hopefully enough of a puzzle to keep you thinking. Have a go if you haven't already.