We believe math and science education should be free and accessible to everyone. Why education matters >

RSA Calculator

Explore how RSA encryption works using small prime numbers. This educational calculator generates public and private keys, encrypts a message, and decrypts it back to demonstrate the complete RSA process.

RSA (Rivest-Shamir-Adleman) is one of the first public-key cryptosystems and is widely used for secure data transmission. This calculator demonstrates the algorithm with small numbers so you can see every step.

How RSA Works:

  1. Choose two primes p and q. Compute n = p x q.
  2. Compute Euler's totient: phi(n) = (p-1)(q-1).
  3. Choose public exponent e such that 1 < e < phi(n) and gcd(e, phi(n)) = 1. The value 65537 is a common choice.
  4. Compute private exponent d such that e x d = 1 (mod phi(n)).
  5. Encrypt: ciphertext c = m^e mod n.
  6. Decrypt: plaintext m = c^d mod n.

Why It Works:

The security relies on the difficulty of factoring n back into p and q. Multiplying two primes is fast, but reversing that multiplication (factoring) is computationally hard for very large numbers. Real RSA uses primes with hundreds of digits.

Important Note:

This calculator uses small numbers for educational purposes. Real RSA implementations use 2048-bit or larger keys, which involve primes with over 300 digits each.

Did this solve your problem?

Frequently Asked Questions

Search Calculators

Search across all calculator categories