Text tool

Affine Cipher Encoder Decoder

Choose a and b, then encode or decode text locally. The multiplier a must be coprime with 26.

In-browser processingNo account requiredPrivacy details ↗

Enter text, choose a and b, then run the tool. Only A–Z and a–z change. Case and all other characters are preserved. a must be coprime with 26. Valid values: 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25.

Everything runs locally in your browser. This classical cipher is not secure encryption.

A QUICK WALKTHROUGH

How to use this tool

  1. Enter text and choose Encode or Decode.
  2. Set a to a value coprime with 26 and b from 0 to 25.
  3. Run the tool and review or copy the result.

Reversible keys

The multiplier a must satisfy gcd(a, 26) = 1. Valid a values are 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, and 25. Decode uses the modular inverse of a and subtracts b.

Local and limited by design

Only ASCII A–Z and a–z are transformed in this browser. Case is preserved; spaces, punctuation, digits, accented letters, emoji, and other non-ASCII characters pass through unchanged. This classical cipher is not secure encryption.

GOOD TO KNOW

Common questions

Which a values are valid?

Any value from 0 to 25 whose greatest common divisor with 26 is 1: 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, or 25.

What does b do?

b is the additive shift and may be any integer from 0 to 25.

Is this secure?

No. Affine cipher is a classical learning and puzzle tool, not protection for sensitive data.