Skip to content
Also from us: TypologyOnline.com · Free personality tests

Affine Cipher

Encrypt text with E(x) = (ax + b) mod 26 using configurable keys and formatting options.

Input

Output

Using This Tool: Guide & Notes Show guide

The Affine cipher transforms each letter number with E(x) = (ax + b) mod 26.

How to use it

  • Choose Encrypt or Decrypt.
  • Select a valid multiplier key a and set the shift key b.
  • Paste text into the input box and check the output plus the key summary.
  • Use Reset defaults if the keys or formatting get confusing.

Options and settings

  • Key a is the multiplier. It must be coprime with 26 so the cipher can be reversed.
  • Key b is the shift. Any integer is accepted and then reduced modulo 26.
  • Preserve case and keep punctuation control how the visible text is carried through.
  • Group letters and block size format the output without changing the underlying cipher.

Notes

  • Valid a values are limited because not every number has a modular inverse mod 26.
  • Affine is stronger-looking than Caesar, but still easy to attack with enough text.
Related Article

Affine Cipher: Where Substitution Becomes Algebra

How multiplication, modular arithmetic, and a two-number key turned simple alphabet substitution into one of classical cryptography's cleanest mathematical teaching tools.

Read the article
Signal acquired

A note from the team

We build these tools because we love cryptography, encoding, and making difficult ideas easier to explore. If they've helped you, even a small coffee means the world to the project. Thank you!

Say thanks on Ko-fi