← All Tools

Affine Cipher

The Affine cipher is a substitution cipher that combines multiplication and addition modulo 26. Encryption is E(x) = (ax + b) mod 26, where a must be coprime with 26 so the mapping is reversible. Only 12 valid values of a exist (1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25) โ€” multiply that by the 26 choices for b and you get 312 possible keys, trivially brute-forceable.

Encrypt: E(x) = (5 ยท x + 8) mod 26   ยท   Decrypt: D(y) = 21(y โˆ’ 8) mod 26
letters encoded 0 total chars 0 key space explored 1 / 312

Substitution Table

Brute Force All Keys

Click any row to load that key. 312 possible combinations โ€” instant crack for short ciphertext.