RSA Totient
Also known as phi n rsa · (p-1)(q-1) · euler totient of a semiprime · rsa phi
Worked example: φ(3233) = 60 × 52 = 3120. Press Try an example to run it live, then adjust anything.
Enter your known values, leave one input blank, and solves for the missing one. Tap a variable’s symbol to see what it means, with a typical value.
Where RSA Totient fits
See also
RSA Modulus: The public half of the same key, from the same two primes.Totient of a Prime Power: The totient when the modulus is one prime raised to a power instead.RSA Primes from Modulus and Totient: Both use euler totient and first prime.RSA Totient explained
Euler's totient counts how many numbers below n share no factor with it. When n is a product of two distinct primes the count is easy to reason out: of the numbers below n, the multiples of p are q of them and the multiples of q are p of them, with 0 shared. Subtracting gives , which factors as . For the textbook key that is .
φ(n) is what makes the encryption reversible. The private exponent d is chosen so that , and Euler's theorem then guarantees that raising to e and back to d returns the original message. This is also why φ is as secret as the primes themselves: hand someone φ(n) alongside the public n and they can recover p and q immediately, which is what the companion formula on this site does.
Two footnotes worth knowing. Modern implementations usually use the Carmichael function λ(n) = lcm(p−1, q−1) rather than φ, because it gives a smaller valid d and slightly faster decryption; φ still works and is what the original paper specified. And p must differ from q. If they are equal, n = p² and the count is , not : the derivation above assumed the multiples of p and of q were different sets.
RSA Totient formula
- = Totient
- = First prime
- = Second prime
Cite this page
formula.expert. (2026, October 31). RSA Totient Formula & Calculator. https://formula.expert/solvers/rsa-totient