Affine Cipher
Encode and decode messages with the Affine substitution cipher.
Result
How to use
- Enter your values in the fields above.
- Press Calculate to see your result instantly.
- Use the Share button to copy a link to your result.
About this calculator
This tool encrypts and decrypts text with the Affine cipher, a substitution cipher defined by E(x) = (a·x + b) mod 26, where x is a letter's numeric position (A=0…Z=25), a and b are the encryption keys, and the result maps back to a letter. Because it needs modular division to decrypt, key a must be coprime with 26 (share no common factor besides 1) — valid choices are 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25.
It's a classic teaching example in introductory cryptography courses because it generalizes both the Caesar cipher (when a=1) and simple multiplicative ciphers, while showing why modular arithmetic and coprimality matter for invertibility. Enter your text and the two keys a and b to encode or decode a message.
Was this helpful?
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
No calculators found
Comments (0)