Cryptography & Security
Advanced

RSA Decryption

Recovers the message using the private exponent d.

Formula

m=cd mod nm = c^d \bmod n

Variables

mMessage
cCiphertext
dPrivate exponent
nModulus

Example

c=31, d=7, n=33: m = 31^7 mod 33 = 4

How it works

RSA decryption turns an encrypted residue c back into the original message m by raising c to the private exponent d modulo n. The reason this works is that d is chosen so that, for the matching public exponent e and modulus n, the exponents undo each other modulo the hidden totient structure of n, making m^{ed}  m mod n for valid messages. In practice, this is the inverse operation to RSA encryption and relies on modular arithmetic, fast exponentiation, and the mathematical properties of prime factorization.

When to use it

Use this when you have an RSA ciphertext and the private key parameters and need to recover the plaintext value. It appears in secure communications, digital key handling, and any setting where RSA is used to decrypt small integer blocks or values represented as integers.

Worked example, step by step

Given c = 10, d = 3, n = 33 Step 1: Compute m = c^d mod n = 10^3 mod 33 Step 2: Evaluate 10^3 = 1000 Step 3: Divide by 33: 1000 = 33 30 + 10, so the remainder is 10 Step 4: Therefore, m = 10

Common mistakes to avoid

  • Using the public exponent e instead of the private exponent d for decryption
  • Forgetting the modulus n, which makes the result far too large and incorrect
  • Assuming every integer ciphertext decrypts to a meaningful message without checking the RSA encoding scheme

Did You Know?

RSA's security rests on the fact that factoring a 2048-bit modulus would take longer than the age of the universe.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026