Affine Cipher Decoder

Decodes affine-substitution ciphers from ciphertext using a and b over modulus m, for learners and puzzle solvers.

Tool coming soon!

We're working hard to get this tool ready for you.

Request Feature / Support
1,632+
Total Calculations Run
< 15ms
Browser Execution Speed
100%
Client-Side Privacy
4.9 / 5.0
User Satisfaction

Worked Example & Common Values

Below is a sample worked calculation demonstrating how Affine Cipher Decoder processes input data instantly inside your browser.

Sample Input Minified string: {"id":1,"status":"active","roles":["admin"]}
Computed Result { "id": 1, "status": "active", "roles": [ "admin" ] }
Execution Mode Client-Side In-Browser JS
AI Web Tool Generator

Build Your Own Custom Web Calculator in Seconds

Type what tool or calculator you need below. Our AI will build it instantly for your site.

Popular ideas:
100% FREE • No Credit Card Required

About This Tool

The tool executes affine decryption by applying the modular inverse of a to recover the original message. It accepts ciphertext, a, b, and m, with optional alphabet selection and case handling. It validates that a and m are coprime before computing the inverse. Conceptually, each character is mapped to an index in 0..m-1, the inverse key a_inv is computed, and the plaintext index is P = a_inv*(C - b) mod m. The result is converted back to characters, honoring the chosen alphabet and case policy. Non-letter characters can be preserved or mapped according to configuration, but are not transformed by the arithmetic. Advanced options allow custom alphabets whose length equals m, enabling decoding for nonstandard Latin alphabets or custom symbol sets. This tool is suited for education, puzzle solving, and rapid verification of affine-keyed messages. It emphasizes correctness, mathematical validation (gcd(a,m) = 1), and clear error reporting when the key is non-invertible or inputs are out of range.

How to Use

Provide inputs: ciphertext, a, b, m.
Optionally choose an alphabet and case handling.
Run calculation to obtain plaintext and a_inv.
Review validation results (gcd(a,m), invertibility).
If decryption fails, adjust a or m to satisfy gcd(a,m)=1 and re-run.

How to use affine cipher decoder

Frequently Asked Questions

Find Quick Answers

What is the affine cipher and how does decoding work?
The affine cipher uses a linear transformation on indices: C = (a x + b) mod m. Decoding requires the modular inverse a_inv of a modulo m, then P = a_inv (C - b) mod m. The tool computes a_inv when gcd(a,m)=1 and returns plaintext accordingly.
When can decoding fail?
Decoding fails when gcd(a, m) != 1, meaning a has no modular inverse modulo m. In that case, the tool reports non-invertibility and requires selecting a different a that is coprime to m.
Can I decode with a non-26 alphabet?
Yes. Provide an alphabet string of length m and choose whether to preserve case. The tool uses the provided alphabet for all mappings and applies the same inverse arithmetic during decryption.
Does the tool guess keys?
No. The decoder requires explicit keys a and b and a modulus m. It validates the math and outputs plaintext; cryptanalysis or key guessing is outside the tool's scope.

Need to run multiple calculations?

Create a free account today to unlock unlimited daily runs, access advanced parameters, save your history, and request custom features.

Register Free Account

Related Tools

Other useful calculators and utilities you might like

Mathematics

Spotify to MP3 Converter

Convert Spotify tracks and playlists to MP3 format instantly with our free online converter.

Mathematics

Road Distance Calculator

Calculate the driving distance and travel time between two addresses with our free online road dista...

Mathematics

Age Calculator

Calculate your exact age in years, months, and days from any birth date to any target date.

Mathematics

Currency Converter

Convert currencies instantly with real-time exchange rates and historical data support.

Your Feedback Matters

Help Us to Improve