Affine Cipher

Encode and decode messages with the Affine substitution cipher.

How to use

  1. Enter your values in the fields above.
  2. Press Calculate to see your result instantly.
  3. Use the Share button to copy a link to your result.

About this calculator

This tool encrypts and decrypts text with the Affine cipher, a substitution cipher defined by E(x) = (a·x + b) mod 26, where x is a letter's numeric position (A=0…Z=25), a and b are the encryption keys, and the result maps back to a letter. Because it needs modular division to decrypt, key a must be coprime with 26 (share no common factor besides 1) — valid choices are 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25.

It's a classic teaching example in introductory cryptography courses because it generalizes both the Caesar cipher (when a=1) and simple multiplicative ciphers, while showing why modular arithmetic and coprimality matter for invertibility. Enter your text and the two keys a and b to encode or decode a message.

Was this helpful?

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators