Welcome back! In our first lesson, we established the crucial difference between codes and ciphers, setting the stage for our journey into cryptography. We learned that ciphers operate on the letters of a message, either by substituting them or rearranging them, and that we would be focusing primarily on these algorithmic methods for hiding information.
Today, we'll get our hands dirty with one of the oldest and simplest substitution ciphers in history: the Atbash cipher. Our goal is to become proficient in using this ancient method to both encrypt and decrypt messages. While simple, the Atbash cipher has a fascinating history and introduces a key concept—reciprocity—that is important in the world of cryptography.
The Mirror Alphabet
At its core, the Atbash cipher is a substitution cipher with a very straightforward rule: the alphabet is reversed. The first letter becomes the last, the second becomes the second-to-last, and so on.
For the English alphabet, this means:
- A is swapped with Z
- B is swapped with Y
- C is swapped with X
...and so on, right through the middle, where M is swapped with N.
The diagram below shows this simple mapping.

This method was originally used with the Hebrew alphabet, and its name comes from this origin. We'll explore that history in a moment, but first, let's understand the mechanics.
This article provides a concise introduction to the Atbash cipher, its history, and its mechanics.
Read the introduction to understand the cipher's origin and its key characteristic: the lack of a secret key. Then, read the sections on Encryption and Decryption. Pay close attention to the example atbash -> ZGYZHS. Most importantly, notice the sentence that begins "Due to the symmetric nature of this cipher...". This is the most interesting property of Atbash.
Encryption and Decryption: Two Sides of the Same Coin
As you just read, the most remarkable feature of the Atbash cipher is its symmetry, or reciprocity. The process for encrypting a message is exactly the same as the process for decrypting it.
Let's try it. If we want to encrypt the word HELLO:
His the 8th letter, so it maps to the 8th letter from the end,S.Eis the 5th letter, mapping to the 5th from the end,V.Lis the 12th letter, mapping to the 12th from the end,O.Omaps back toL.
So, HELLO becomes SVOOL.
Now, let's decrypt SVOOL using the exact same process:
Smaps toH.Vmaps toE.Omaps toL.
And we get HELLO back. Because the key is a perfect reversal, applying the cipher a second time perfectly undoes the first application.
A Bit of Practice
Let's look at a few more examples to solidify the concept. Notice how spaces and punctuation are typically left unchanged, as the cipher only applies to letters.
Atbash Cipher Examples: Complete Tutorial with Code Implementation | Caesar Cipher
This resource provides several clear, interactive-style examples.
Review the examples provided, from Simple Word to "Complex Message". For each one, trace a few letters yourself to confirm you understand the mapping. For example, in the "Attack at Midnight" example, confirm that A becomes Z, t becomes g, and k becomes p.
Historical Roots and a Mathematical View
The Atbash cipher is not just a theoretical exercise; it has genuine historical roots. Its name and earliest known use come from the Hebrew alphabet, as seen in ancient texts like the Book of Jeremiah in the Bible.

The name "Atbash" itself is a demonstration of the cipher. It's formed by combining the first and last letters of the Hebrew alphabet (Aleph and Tav) and the second and second-to-last letters (Beth and Shin).
Atbash Cipher Examples: Complete Tutorial with Code Implementation | Caesar Cipher
Let's dive into the history described in this article.
Read the two sections on the cipher's Hebrew origins: Hebrew Atbash Cipher Examples and The Name "Atbash". These sections explain how the cipher was used to subtly refer to "Babel" (Babylon) as "Sheshach".
This historical context is fascinating, but we can also look at the cipher through a mathematical lens. Since you're comfortable with algebra, we can express the Atbash rule as a simple formula.
Let's number the positions of the letters in the alphabet starting from 0:
A=0, B=1, C=2, ..., Y=24, Z=25.
If we have a plaintext letter at position , its corresponding ciphertext letter will be at position . The Atbash rule is:
For example, for the letter C, its position is . The formula gives us . The letter at position 23 is X. So, C encrypts to X.
This formula also neatly proves the cipher's reciprocity. If we encrypt the ciphertext again, we get:
Substitute our first formula into this one:
We get the original position back! This simple algebraic proof shows why applying the Atbash cipher twice always returns you to the original message.
Your Turn
Now it's time for you to be the cryptographer. Use the Atbash cipher to perform the following tasks. You can write out the A-Z/Z-A alphabet pair on a piece of paper to help.
- Encrypt the word
SECRET. - Encrypt the word
CIPHER. - Decrypt the message
GSVXIVG.
(Scroll down for the answers after you've tried them yourself.)
Answers:
HVXIVGXRKSVITREASURE
A Simple but Insecure Cipher
The Atbash cipher is easy to use and has a neat symmetric property, but how secure is it?
Let's consider the weakness of this cipher.
Read the short Discussion section. The author points out the fatal flaw of the Atbash cipher.
As the article explains, the primary weakness of the Atbash cipher is its lack of a key. The "key" is the method of substitution, and in Atbash, there is only one possible method: reversing the alphabet. If an enemy intercepting your messages even suspects you are using Atbash, they can decrypt your messages as easily as you can. There is no secret to protect.
This stands in contrast to the Caesar cipher we briefly mentioned last lesson, where the secret "key" is the number of letters to shift the alphabet. With a shift of 3, A becomes D. With a shift of 5, A becomes F. The key adds a layer of secrecy that Atbash lacks.
Conclusion
In this lesson, we took our first practical step into making and breaking secret messages. We thoroughly explored the Atbash cipher, one of history's earliest substitution methods.
Key Takeaways:
- The Atbash cipher is a substitution cipher that works by reversing the alphabet (A↔Z, B↔Y, etc.).
- It is reciprocal, meaning the same algorithm is used for both encryption and decryption. Applying it twice returns the original text.
- It has ancient origins, named after the Hebrew alphabet, and was famously used in biblical texts to encode names.
- Mathematically, for a 0-indexed alphabet, the transformation is simply .
- Its greatest weakness is the lack of a key, making it trivial to break for anyone who knows the method.
Preview of the Next Lesson:
We've now seen two substitution ciphers: the keyless Atbash and the keyed Caesar cipher. In our next lesson, we'll switch gears to an entirely different method of hiding information. We will investigate the Scytale, an ancient device used by Spartan generals to perform a transposition cipher. Instead of substituting letters, we will be rearranging them into a new, scrambled order. This will give you a hands-on feel for the other major family of classical ciphers.