Atbash Cipher
Reverse-alphabet substitution cipher (A↔Z, B↔Y…).
Overview
The Atbash cipher is one of the oldest known substitution ciphers — it simply reverses the alphabet. A becomes Z, B becomes Y, C becomes X, and so on. Because the mapping is its own inverse, encoding and decoding are the same operation: run the text through twice and you get the original back.
Cryptography students, puzzle and ARG designers, and escape-room creators use Atbash as a gentle intro to classical cryptography. It's also a common stop on capture-the-flag challenges, so being able to spot and decode it quickly is a useful skill.
How it works
Atbash was originally a Hebrew cipher (aleph ↔ tav, beth ↔ shin, hence the name), but it works identically on any alphabet. For the 26-letter Latin alphabet, the substitution rule is cipher_letter = 25 - plain_letter when letters are indexed 0 (A) through 25 (Z). Non-letter characters pass through unchanged, and case is normally preserved.
Worked example: encoding "ATTACK" letter by letter — A (0) → Z (25), T (19) → G (6), T (19) → G (6), A (0) → Z (25), C (2) → X (23), K (10) → P (15) — yields "ZGGZXP".
Examples
Input: HELLO
Output: SVOOL
Input: ATTACK AT DAWN
Output: ZGGZXP ZG WZDM
Input: SVOOL
Output: HELLO
FAQ
Is Atbash secure?
Not at all. Because it's a fixed substitution, anyone who recognizes the pattern can decode it instantly. It's a puzzle, not a security tool.
Why is encoding the same as decoding?
The mapping pairs each letter with its mirror (A↔Z, B↔Y). Applying the swap twice returns the original letter, so one button does both directions.
Does it work on numbers and punctuation?
No. Atbash only touches letters. Digits, spaces, and punctuation pass through unchanged.