Free tool

RSA Step-by-Step Visualizer

Generate an RSA key pair and encrypt a message watching every operation: the modulus n, Euler's φ, the extended Euclid that derives d, and the binary exponentiation used to encrypt and decrypt. Exact BigInt math, validated against OpenSSL and the algorithm's classic vector.

Generate a textbook RSA key pair with small numbers and follow every operation: n = p·q, φ(n) = (p−1)(q−1), d via extended Euclid, encryption and decryption by binary exponentiation. All math uses exact BigInt, no rounding.

Built by

Miguel Ángel Colorado Marin (MACM)

Full-Stack Developer · Guadalajara, España

I develop web apps, digital tools and full projects — from design to deployment.

Contact me

RSA protects TLS connections, code signing and SSH keys, yet it's taught as a magic formula: "e is public, d is secret". This tool takes the formula apart. You pick two small primes p and q, an exponent e and a message m, and the tool builds the modulus n = p·q, computes φ(n) = (p−1)(q−1), derives the private key d with the extended Euclidean algorithm (showing the full table of quotients and coefficients), and encrypts with binary exponentiation, showing the accumulator bit by bit. No rounding, no approximations: every calculation uses exact BigInt, and the implementation passes a test bank that compares it against OpenSSL with real 512-bit keys, plus the algorithm's classic vector (p=61, q=53, e=17 → c=2790).

Features

  • Full key generation: n, φ(n) and d with traces
  • Extended Euclid table by table to derive d
  • Binary exponentiation with the accumulator at every bit
  • Exact BigInt arithmetic, no rounding
  • Verified against OpenSSL and the classic vector (p=61, q=53)

How to visualize RSA encryption?

  1. 1

    Pick p, q, e and m

    The algorithm's classic example loads by default; you can also generate a random example with one click.

  2. 2

    Generate the keys

    n = p·q, φ(n) and the private key d are computed with the full extended Euclid table.

  3. 3

    Encrypt and decrypt

    Watch c = mᵉ mod n and m′ = cᵈ mod n with the expandable bit-by-bit binary exponentiation.

  4. 4

    Check the verification

    Badges confirm primality, coprimality, e·d ≡ 1 (mod φ) and that decryption recovers the message.

Frequently asked questions

Why are the numbers so small?

So you can read them. Real RSA uses primes hundreds of digits long; with p=61 and q=53 you can follow every operation by eye. The arithmetic is identical: the internal library uses BigInt and is validated against OpenSSL with real 512-bit keys, where the same code handles 154-digit numbers.

Can I use this to encrypt real data?

No, and the tool itself says so: this is textbook RSA, no padding, deterministic and only valid for messages smaller than n. Real RSA uses OAEP with 2048+ bit keys. To protect real data use this suite's AES-256 Encryptor, which implements GCM via Web Crypto.

Why does φ(n) appear instead of λ(n)?

Rivest, Shamir and Adleman's original RSA is formulated with φ(n) = (p−1)(q−1), and that's the version taught. λ(n) = lcm(p−1, q−1) is also valid and yields smaller private exponents, but the idea is unchanged: any d with e·d ≡ 1 (mod λ) works. φ is shown because it's the classic formalism.

Related tools

Embed RSA Step-by-Step Visualizer on your site

Add RSA Step-by-Step Visualizer to any web page with a simple iframe. Free, with attribution to miguelacm.es.

<iframe
  src="https://miguelacm.es/embed/rsa-visualizer"
  width="100%"
  height="700"
  frameborder="0"
  title="RSA Step-by-Step Visualizer — miguelacm.es"
></iframe>
View embed in new tab →