Affine Cipher — Free Online Tool

Encrypt and decrypt with the affine cipher using multiplier and shift keys (a coprime to 26). Affine Cipher is a free online tool from the ToolsRift Text Encoding Tools collection. It runs entirely in your browser — nothing to install, no signup, and your data never leaves your device.

Loading Affine Cipher

How to use Affine Cipher

  1. Open the Affine Cipher above — it loads instantly, no account needed.
  2. Enter or upload your input. Everything is processed locally on your device.
  3. Get your result immediately and copy or download it with one click.

Frequently asked questions

How does the affine cipher work?

Each letter's position x (0–25) is transformed with the formula E(x) = (a·x + b) mod 26. Decryption uses the modular inverse of a: D(y) = a⁻¹·(y − b) mod 26.

Why must 'a' be coprime with 26?

Only values of a that share no common factor with 26 (1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25) have a modular inverse, which is required to decrypt the message uniquely.

What happens to spaces and punctuation?

Only A–Z letters are transformed. Spaces, digits, and punctuation pass through unchanged, preserving the layout of your text.

More Text Encoding Tools

Polybius Square Cipher
Convert letters to row-column number pairs with the 5×5 Polybius square (I/J shared)
Tap Code Translator
Encode text as prisoner tap-code row,column taps and decode taps back to letters (K→C)
Beaufort Cipher
Encrypt and decrypt with the reciprocal Beaufort cipher using a keyword
Gronsfeld Cipher
Encrypt and decrypt with the Gronsfeld cipher using a numeric digit key
Vigenère Cipher
Encrypt and decrypt text with the classic Vigenère polyalphabetic cipher using a keyword
Autokey Vigenère Cipher
Encrypt and decrypt with the autokey cipher where the plaintext extends the keyword stream

← View all Text Encoding Tools