Atbash Cipher

Work in progress. This note is still being written and incomplete.

A classical, mono-alphabetic cipher. Each letter maps to one fixed letter, so plaintext letter frequencies are preserved in the ciphertext.

Originally devised for the Hebrew alphabet, then applied to Latin and other alphabets.

You can find an implementation of the Atbash cipher in sahithyandev/ciphers.

Encryption

Each letter in the alphabet is replaced with the letter at its mirrored position, counting from the opposite end.

c=25mmod26c = 25 - m \mod 26

Here:

  • mm: plaintext letter, encoded as an integer 0 (a) to 25 (z)
  • cc: ciphertext letter, same encoding

Atbash has no key. a always maps to z, b to y, and so on.

Decryption

The mirror map is its own inverse, so decryption applies the same operation.

m=25cmod26m = 25 - c \mod 26

Attacking

There is no key to search. Recovering the plaintext is a single substitution away once Atbash is suspected.

Worked Example

Plaintext nothingistrue, with a=0a = 0 to z=25z = 25.

Each letter maps to its mirror c=25mc = 25 - m.

  • n(13)12=mn (13) \to 12 = m
  • o(14)11=lo (14) \to 11 = l
  • t(19)6=gt (19) \to 6 = g
  • h(7)18=sh (7) \to 18 = s

Ciphertext is mlgsrmtrhgifv.

Decryption applies the same map again.

  • m(12)13=nm (12) \to 13 = n
  • l(11)14=ol (11) \to 14 = o

Plaintext is nothingistrue.

No key exists, so testing the single Atbash substitution against the ciphertext confirms it in one step.

Written by September 16, 2026 2 min read
Was this helpful?