Atbash Cipher

A classical, mono-alphabetic, keyless cipher. 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.

Key Space

Atbash has no secret key. Its key space contains 1 fixed alphabet reversal, so exhaustive search is unnecessary.

Encryption

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

c=25−mmod  26c = 25 - m \mod 26
Here:
mm
plaintext letter, encoded as an integer 0 (a) to 25 (z)
cc
ciphertext letter, same encoding

Decryption

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

m=25−cmod  26m = 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.

Solution Reveal Hide

Each letter maps to its mirror c=25−mc = 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 November 3, 2026 1 min read
Was this helpful?