Modulo Exponentiation Calculator

Fast modular exponentiation for cryptography, math, and coding projects with confidence. Handles huge integers using optimized algorithms and optional big libraries for accuracy. See step breakdowns, history, and shareable links for reproducibility across browsers easily. Export clean tables in CSV and PDF formats instantly.

Enter Values

Results History

# Timestamp Base (a) Exponent (e) Modulus (n) Result Engine Time (ms)

Example Data

Base (a)Exponent (e)Modulus (n)Expected a^e mod nAction
210100024
7256139
1234567899876543219746
5117191
364464536
1010001716
99912345100004999

Formula used

We compute a^e mod n using fast binary exponentiation. At each step, if the current exponent bit is one, we multiply the accumulator by the base. Each loop squares the base modulo n and halves the exponent.

result = 1
while e > 0:
  if e is odd: result = (result * a) mod n
  a = (a * a) mod n
  e = floor(e / 2)
          

When available, the calculator uses high‑performance libraries for big integers, equivalent to computing powmod(a, e, n) safely for very large values.

How to use this calculator

  1. Enter integer values for base, exponent, and modulus.
  2. Pick an engine or leave it on Auto for best choice.
  3. Optionally enable step breakdown to see the bit‑wise process.
  4. Click Compute; copy the result or export your history.
  5. Use “Copy Permalink” to share prefilled inputs with teammates.

Frequently Asked Questions

It is the operation of raising a to power e and taking the remainder modulo n: compute a^e mod n efficiently without expanding to enormous intermediate numbers.

Algorithms like RSA and Diffie–Hellman rely on fast and correct modular exponentiation on very large integers.

Yes. Choose Auto, GMP, or BCMath engines to safely handle very large values beyond native integer ranges.

No. The algorithm works for any positive modulus. For theory, Euler’s totient and Carmichael functions describe exponent cycles.

Negative exponents require modular inverses. Compute the inverse of a modulo n first, then raise to the absolute exponent.

Use integers for base, exponent, and a positive modulus. Exponent zero returns one modulo n; modulus must be greater than zero.

Use the Copy Permalink button to share inputs. Export the history or examples tables as CSV or PDF using the provided buttons.

Applications & Typical Parameters

Common real‑world contexts where a^e mod n is essential, including indicative parameter sizes.

Context Base (a) Exponent (e) Modulus (n) Notes
RSA encryption Message m as integer Public e = 65537 Composite, ~2048–4096 bits Computes c = m^e mod n
RSA decryption Cipher c Private d Same n as above Computes m = c^d mod n
Diffie–Hellman Generator g Secret a or b Prime p, ~2048+ bits Shared key via g^{ab} mod p
Fermat test Random a n-1 Candidate n Checks a^{n-1} ≡ 1 (mod n)
ElGamal / DSA Generator g, message hash Private/random exponents Prime p, 2048+ bits Core step in signing/verification

Key Properties & Theorems (Data Sheet)

Helpful facts to reason about outputs and to validate results.

Property / Theorem Statement Implication
Modular reduction a ≡ b (mod n) ⇒ a^e ≡ b^e (mod n) Reduce base first without changing result
Fermat’s little theorem a^{p-1} ≡ 1 (mod p) for prime p, p ∤ a Exponent cycles mod primes
Euler’s theorem a^{φ(n)} ≡ 1 (mod n) if gcd(a,n)=1 Use φ(n) to reduce huge exponents
Carmichael function a^{λ(n)} ≡ 1 (mod n) for gcd(a,n)=1 Often smaller exponent than φ(n)
Binary exponentiation cost ⌊log₂ e⌋+popcount(e) multiplications, ⌊log₂ e⌋ squarings Runtime grows with exponent bits
CRT speed‑up For RSA, compute mod p and q then recombine ~3–4× faster decryption

Related Calculators

Proportion and Ratio Calculatorsquare root calculator with stepsnegative square root calculatorfraction square root calculatorsquare root division calculatordecimal to square root calculatorderivative of square root calculatorharmonic mean calculatorbinomial distribution mean calculatordiscrete random variable mean calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.