Affine Cipher

Encrypt and decrypt text using the Affine cipher, locally in your browser.

🔒 Your data is processed locally in your browser and is never uploaded to our servers.

How it works

The Affine cipher transforms each letter using the formula E(x) = (ax + b) mod 26. For decryption, the modular inverse of a is used. Only letters are transformed; spaces, numbers and punctuation remain unchanged.

Examples

With a = 5 and b = 8:

HELLO → RCLLA

Security notes

The Affine cipher is a classical substitution cipher and is not considered secure for protecting sensitive information.

FAQ

What values can I use for a?

The value of a must be relatively prime to 26. Valid values are 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23 and 25.

What is b?

b is the additive shift applied after multiplying the letter value by a.

Are spaces and punctuation changed?

No. Only letters from A-Z and a-z are transformed.