RSA Calculator

Quick answer

The RSA calculator walks through textbook RSA: from two primes p and q and a public exponent e it computes the modulus N, Carmichael's λ(N), the private exponent d, and encrypts and decrypts a message number.

Modulus N = p·q
3233
λ(N) = lcm(p − 1, q − 1)
780
Private exponent d
413
Encrypted message Mᵉ mod N
2790
Decrypted ciphertext Cᵈ mod N
65

RSA (Rivest–Shamir–Adleman, 1977) secures web traffic, e-mail and digital signatures. Its security rests on the difficulty of factoring N = p·q when p and q have hundreds of digits. This calculator uses small numbers to show the mechanics.

How to use the RSA Calculator

  1. Prime p
  2. Prime q
  3. Public exponent e
  4. Message M (number smaller than N)
  5. Received ciphertext C to decrypt

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

How it works

Enter two different primes, a public exponent coprime to λ(N) (65537 is standard; small values like 17 work for small primes), a message M smaller than N and a ciphertext C to decrypt. Exact big-integer arithmetic is used.

Formula

N = p·q, λ(N) = lcm(p − 1, q − 1), d = e⁻¹ mod λ(N) C = Mᵉ mod N, M = Cᵈ mod N

Worked example

Inputs — Prime p: 61; Prime q: 53; Public exponent e: 17; Message M (number smaller than N): 65; Received ciphertext C to decrypt: 2,790.
Results — Modulus N = p·q = 3233; λ(N) = lcm(p − 1, q − 1) = 780; Private exponent d = 413; Encrypted message Mᵉ mod N = 2790; Decrypted ciphertext Cᵈ mod N = 65.

Key terms

Public key
(N, e), shared openly.
Private key
d, kept secret.

Frequently asked questions

Is this secure?

No – real RSA uses primes of 1,024 bits or more, plus padding.

Why 65537?

It is prime, and its binary form 10000000000000001 makes encryption fast.

What is λ(N)?

Carmichael's function; φ(N) = (p − 1)(q − 1) also works.

Why must M be smaller than N?

Arithmetic is mod N, so larger messages would wrap around.

Sources

  1. Wolfram MathWorld – RSA encryption
  2. Rivest, Shamir, Adleman (1978). A Method for Obtaining Digital Signatures and Public-Key Cryptosystems

Cite this calculator

Speedy Calculator. (2026). RSA Calculator. Speedy Calculator. https://speedycalculator.com/calculators/math/rsa/