Affine Cipher Decoder

Encode and decode Affine ciphers using a and b parameters. Useful when Caesar isn’t enough.

Plaintext

This page is dedicated to Affine Cipher Decoder.
Letters only.
Offset shifts the starting zig-zag position before placing the first character.

Ciphertext

Affine Cipher Decoder — explanation, history & tips

Family: Substitution (mathematical) Era: Classical / early modern Strength: Weak

The Affine cipher is a substitution cipher defined by two numbers, a and b, applied to letter indices modulo 26. Enter a and b and this tool will encode or decode immediately, making it easy to experiment with parameters and verify solutions.

  • Pick Encode or Decode.
  • Enter your text.
  • Set a and b (mod 26).
  • If decoding fails, your a likely isn’t invertible mod 26.

History (quick)

An affine cipher generalises Caesar by multiplying and shifting letter indices: E(x)=ax+b (mod 26). It’s still a monoalphabetic substitution, so frequency analysis applies, but the math angle makes it common in classrooms and puzzle sets.

Quick FAQs

What values of a are valid?
a must be coprime with 26 (e.g., 1,3,5,7,9,11,15,17,19,21,23,25) so an inverse exists.
Why does decoding sometimes not work?
If a shares a factor with 26, it has no modular inverse, so decoding isn’t well-defined.
Is Affine stronger than Caesar?
Slightly, but still monoalphabetic—frequency analysis breaks it quickly.
Want to decode with no key? Try our Cipher Breaker →