Affine Cipher

Encrypt or decrypt with the affine formula, validate the key and brute-force a decode when the key is lost.

Affine cipher

Enter text to encrypt or decrypt.
The rule is E(x) = (a x + b) mod 26. Only values of a that share no factor with 26 can be reversed, so the list above holds the twelve valid choices.

How to use the Affine Cipher

  1. Pick the values of a and b that make up your key.
  2. Choose encrypt or decrypt and type the text.
  3. Use brute-force decode when the key is unknown and scan for readable text.

Features

Advertisement

Frequently Asked Questions

Common questions about the free online affine cipher.

It maps each letter to a new one with the formula a times x plus b, taken modulo 26, where x is the position of the letter from zero to twenty five.
The mapping can only be reversed when a shares no factor with 26. Values such as 2, 4 and 13 would map several letters to the same output.
The twelve valid values are 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23 and 25, and the tool lists exactly those in the dropdown.
It tries all twelve valid values of a with every b from 0 to 25 and prints the 312 results, so you can spot the line that reads as plain text.
Yes. Uppercase stays uppercase and lowercase stays lowercase, so the result keeps the same shape as the original message.
They are copied through unchanged. Only the twenty six letters are transformed, which makes the ciphertext easier to read but no stronger.
No. It has only 312 possible keys, so a computer can try every one of them instantly. It is useful for puzzles and for learning, not for secrets.
No. All of the arithmetic happens in your browser, so your text and your key never leave your device.
Yes. The tool is completely free and unlimited, with no account, no sign-up and no tracking of any kind.

Last updated: October 10, 2026