DataToolsLab
Encoding & Number Bases

Affine Cipher

Encrypt and decrypt text with the affine cipher E(x) = (a·x + b) mod 26.

Loading tool…

What is Affine?

The affine cipher is a Caesar cipher with a multiplier: E(x) = (a·x + b) mod 26. Key a must be coprime with 26 or the mapping is not reversible — the tool validates this immediately.

How it works

Encryption maps each letter through (a·x + b) mod 26; decryption uses the modular inverse of a. The coprime check and the inverse are computed with the Euclidean algorithm.

  1. Enter your input. Type or paste your input into the field above — the tool responds instantly.
  2. Review the result. Output updates live as you type. Everything runs entirely in your browser.
  3. Copy or download. Use the Copy button to grab the result, or Download to save it as a file.

Examples

Realistic sample

Type or paste any realistic input — the tool computes the result locally and instantly.

Common mistakes

Expecting a server round-trip

Nothing is uploaded — every tool in this category runs entirely in your browser.

Online