✖

Atbash cipher: the reversed alphabet

The Atbash cipher (Czech “atbaš”) is a cipher with a reversed alphabet: instead of A you write Z, instead of B Y, instead of C X and so on up to M, which becomes N. The word “ahoj” (Czech for “hello”) is encrypted as “zslq”. The most interesting thing is that encrypting and decrypting are exactly the same. If you encrypt “zslq” once more, you get “ahoj” back.

Atbash translator

Type some text and the translator converts it into Atbash as you type. Since both directions are the same, you can also paste in an encrypted message and the original text comes out. It drops accents and writes everything in lower case. Spaces, digits and punctuation stay unchanged.

The default text, “Poklad je pod mostem”, is Czech for “the treasure is under the bridge”.

Atbash chart

At the top you will find the letter from the original text, and below it the letter that replaces it:

A B C D E F G
Z Y X W V U T
H I J K L M
S R Q P O N

Thirteen pairs are enough, because each works in both directions. If you come across N, find it in the bottom row: M is right above it. Atbash works with the 26 letters of the international alphabet. Czech letters with accents are therefore stripped of their accents before encrypting (č becomes c), and CH, which counts as a single letter in Czech, is encrypted as two letters, C and H, so “chata” (Czech for “cabin”) becomes “xszgz”.

You can make the chart yourself: write out the alphabet and under it the same alphabet backwards, from Z to A. The animation shows how the bottom row is reversed: first A and Z swap places, then B and Y, and finally M and N in the middle.

The alphabet at the top and below it the same alphabet, whose letters swap places in pairs until Z to A is formed The alphabet at the top and below it the same alphabet, whose letters swap places in pairs until Z to A is formed

Atbash, or the backwards cipher?

Atbash is sometimes confused with the “backwards cipher”, in which the whole word is written from the end: “ahoj” then becomes “joha”. That is something different: the letters stay the same and only their order is reversed. The two can be combined, though: write the word backwards and convert the result with Atbash. This turns “ahoj” into “qlsz”.

Why does it encrypt and decrypt the same way?

Let us number the letters by their position in the alphabet: A has the number 1, B the number 2 and Z the number 26. In the picture, arcs join the letters that correspond to each other in Atbash, and the grey line between M and N marks the middle of the alphabet. Atbash is a reflection about this middle: each letter jumps to the opposite side, ending up as far from the middle as it was before.

The alphabet with the order of the letters, arcs joining pairs of letters, B and Y highlighted The alphabet with the order of the letters, arcs joining pairs of letters, B and Y highlighted

The red B is 2 and Y is 25, which makes 27. A and Z give 1 + 26 = 27, M and N give 13 + 14 = 27. The sum comes out as 27 because the first letter has the number 1 and the last 26. It is the same for every pair, so the letter in position n changes into the letter in position

27−n.

For example, C is third in order, 27 − 3 = 24, and X is in 24th place.

When we encrypt an already encrypted text a second time, the letter from position 27 − n moves to position 27 − (27 − n) = n, exactly where it started.

How to break Atbash

Breaking it is easy. The Caesar cipher shifts the letters by a few places and that number is its key. Anyone who does not know it simply tries all 25 shifts one after another. Atbash has no key; everybody uses the same chart. Whoever recognises Atbash can read the message straight away.

And whoever does not can crack it by frequency analysis, just like any cipher that always replaces a given letter with one and the same other letter: the most common symbol in a longer text will probably be the most common letter of the language.

Where Atbash comes from

Atbash comes from Hebrew and is named after the first two pairs of letters. The Hebrew alphabet has 22 letters; the first, aleph, changes to the last, tav, and the second, bet, to the last but one, shin. From aleph, tav, bet and shin came the word Atbash. The best-known example is found in the book of the prophet Jeremiah in the Old Testament: the mysterious city of Sheshach appears there. Most scholars interpret it as Babel, that is Babylon, encrypted with Atbash: Hebrew writes only consonants, so Babel is BBL, and in the Hebrew alphabet Atbash turns it into ŠŠK (sh-sh-k).

Atbash at camp

Atbash makes a good first cipher for a camp game: anyone who works out that the alphabet is reversed needs nothing else to solve it. And whoever solves it can use the same chart to encrypt the answer straight away.