What is the Atbash cipher?
The Atbash cipher swaps every letter for its mirror on the opposite end of the alphabet — A becomes Z, B becomes Y, C becomes X, and so on, meeting in the middle at M and N. There's no key to choose and no shift amount to remember: the mapping is fixed, so "Atbash cipher" really just means "read the alphabet backwards, one letter at a time."
That fixed mapping is also why encoding and decoding are the same operation. Run a phrase through Atbash once and you get the mirrored version; run that mirrored version through Atbash again and you land back on the original text. There's nothing to invert — you're applying the identical swap both times, which is the property that makes Atbash a popular first cipher to teach and a common one in puzzle hunts, where "decode this" and "encode this" point to the exact same instruction.
How the mirror-alphabet math actually works
The mirror math is one formula: for a letter at position n (A=1 … Z=26), its Atbash partner sits at position 27-n. A (1) maps to 27-1=26, which is Z. B (2) maps to 25, which is Y. The pattern holds all the way through — and it's why M (13) and N (14) are the only pair separated by just one step, both landing right at the alphabet's midpoint (27-13=14, 27-14=13).
Programmatically, most implementations skip the position-lookup entirely and work from character codes directly: subtract the letter's distance from the start of its case block (A=65 or a=97 in ASCII), then subtract that distance from the end of the block (Z=90 or z=122) instead. Same mirror, no lookup table required — just two subtractions per letter.
A full worked example
Here's the full mapping worked on a real word so you can check your own hand-decoding against it: "PIXELTOOLS" becomes "KRCVOGLLOH".
P(16)→K(11), I(9)→R(18), X(24)→C(3), E(5)→V(22), L(12)→O(15), T(20)→G(7), O(15)→L(12), O(15)→L(12), L(12)→O(15), S(19)→H(8).
Notice L and O swap into each other in both directions (L→O and O→L), same as any letter and its mirror partner — that symmetry is a fast way to sanity-check a hand decode: if your answer for a letter doesn't map back to the original when you mirror it again, you made an arithmetic slip somewhere in that pair.
What happens to numbers, punctuation, and accents
Not every character gets mirrored — only the 26 letters of the Latin alphabet do. Numbers, spaces, punctuation, and accented letters (é, ñ, ü) pass straight through untouched, and letter case is preserved on each character independently rather than normalized to one case for the whole string. That's a direct look at how PixelTools' own Atbash tool is built: it runs a single regex, [a-zA-Z], over the input and only touches characters that match it, leaving everything else exactly as typed.
The practical effect: "Meet at 5pm, José!" mirrors the letters but leaves "5", the comma, and the accent on "é" alone — so if you're building a puzzle clue with accented names or embedded numbers, expect those characters to sit unchanged in the output rather than getting swept into the cipher.
Atbash vs. Caesar and Vigenère
Atbash has no key at all, which is exactly what separates it from a Caesar cipher (a chosen shift amount, 1-25 possibilities) and a Vigenère cipher (a repeating keyword that shifts each letter differently). Once you know a message is Atbash, you already know how to reverse it — there's no shift to brute-force and no key to recover.
That makes Atbash the easiest classical cipher to break, but also the easiest to teach: it's usually the first substitution cipher introduced before Caesar, precisely because the mirror mapping needs no explanation beyond "reverse the alphabet." If you're working through a set of classical ciphers, Caesar and Vigenère are the natural next steps up in complexity — see PixelTools' guides to both.
Where Atbash comes from
Atbash predates modern cryptography by roughly two and a half millennia — it was originally built for the Hebrew alphabet, mirroring aleph with tav, bet with shin, and so on (its name comes from those four Hebrew letters: aleph-tav-bet-shin). It appears in the Hebrew Bible itself, most notably in the Book of Jeremiah, where "Sheshach" is an Atbash encoding of "Babel" (Babylon).
The Latin-alphabet version used in puzzles and cipher tools today is a later adaptation of that same mirror idea to A-Z. It's one of the oldest documented substitution ciphers still in common use for teaching, which is part of why it shows up so often in introductory cryptography courses and history-of-codebreaking material.
When Atbash is (and isn't) the right tool
Atbash is for learning, puzzles, and quick text transforms — not for protecting anything sensitive. With zero key options, anyone who recognizes the pattern (or just tries reversing the alphabet) reads your message instantly, so treat it the same as a fun wordplay trick, not encryption.
Where it genuinely earns its keep: escape-room and puzzle-hunt clues, checking a hand-worked homework answer without recounting mirror positions yourself, and demonstrating substitution ciphers in a classroom before moving on to Caesar and Vigenère. For anything that actually needs to stay private, reach for real encryption — Atbash won't provide it.