PB
Available
lock
lock Free · Private · In-Browser

Affine Cipher

Encode and decode with the affine substitution formula.

A step up from Caesar

The affine cipher transforms each letter with the formula a·x + b modulo 26, combining a multiply and a shift. The Caesar cipher is just the special case where the multiplier is 1.

For the cipher to be reversible, the multiplier a must be coprime with 26 — values like 1, 3, 5, or 7 work. The tool validates this and computes the modular inverse to decode.

Instructive and private

The transformation runs in your browser, so your text is never uploaded.

Frequently Asked Questions

What is an affine cipher?

A substitution cipher where each letter’s position is transformed by a·x + b modulo 26. It generalizes the Caesar cipher.

Why must a be special?

The multiplier a must share no factors with 26 so the cipher can be reversed. The tool checks this for you.

How is it decoded?

With the modular inverse of a, which the tool computes automatically in decode mode.

Take it further
All Free Tools

Browse the full set of free, private, in-browser tools.

Learn More arrow_forward