Affine

From the Buttcrack Cipher Wiki — the free field guide to classical ciphers

Affine — A linear map on letter positions: multiply by a, add b, reduce modulo 26. The multiplier must be coprime with 26 or the map is not reversible.

Linear map x -> a*x + b mod 26. Caesar is the special case a=1.

A worked example§

Encrypting a sample with the cipher itself, at build time:

MEET ME BY THE OLD CLOCK TOWER AT DAWN

Key: a=5, b=8

produces the ciphertext

QCCZ QC NY ZRC ALX SLASG ZAOCP IZ XIOV

This example is generated by running the cipher when the page is built, and the round trip is checked, so it always matches what the solver does.

How it is broken§

Twelve legal multipliers times twenty-six additions is 312 keys — an exhaustive sweep that takes milliseconds.

History and context§

The generalisation that makes Caesar (a = 1) and Atbash (a = 25, b = 25) the same cipher with different parameters.

See also§

Caesar (ROT-N) · ROT13 · Atbash · ROT47 · Reverse

Browse every cipher in the Shift and reciprocal alphabets family, read the history of codebreaking, or return to the wiki main page.

Frequently asked questions§

How is the Affine broken?

Twelve legal multipliers times twenty-six additions is 312 keys — an exhaustive sweep that takes milliseconds.

What key does the Affine use?

(a, b) pair. There are 312 possible keys.

How much ciphertext do I need?

At least 4 characters for this solver to attempt it; short messages can be readable and still not be proof.

Can I break a Affine on this page?

Yes — the browser solver on this page handles it directly. Paste the ciphertext into the solver and press the button.

The facts in this article are generated from buttcrack's cipher registry when the site is built, so they describe the implementation you can run on this page. Registry-generated content is checked against the code; the history is editorial.

Try it live — break a real puzzle

Private by design

Drop in a puzzle. Leave with an answer.

Runs on this device
Try a sample
What this browser solver can—and cannot—do

It tries: Caesar, Atbash, ROT13, affine, Trithemius, rail fence, single-byte XOR, periodic Vigenère-family ciphers, autokey, selected encoding layers (such as Base64, hex, binary, decimal ASCII, Morse, and reverse), and—only with 60+ A–Z letters—statistical substitution.

It does not: prove a decryption, cover every classical cipher, or break modern encryption such as AES or RSA. Its ranking model is tuned for English, so a high score is a lead to verify with the method, key, and source context—not a guarantee.

Short text, non-English plaintext, non-Latin or symbol alphabets, missing keys, and unsupported formats can all leave no high-confidence answer. When that happens, the result includes input-specific observations and suggested next checks; those observations are not a claim to know the exact cause.

No account. No upload. No stored text. The complete solver runs in your browser.

This tool is free and has no account, no upload, no tracking of your text

Everything runs in your browser. If it saved you time, keeping it alive costs nothing but a click.