Skip to content
D DocNectar

Free Modular Exponentiation Calculator

Calculate base^exponent mod modulus using fast exponentiation (repeated squaring) — the technique behind modern cryptography.

100% Free No Signup Works on all devices

Last updated October 5, 2026 · Report an error

Thanks for rating!

Computing a huge power directly (like 7^128) would produce an astronomically large number before ever taking the modulus — fast exponentiation avoids this entirely by squaring and reducing at every step.

This calculator computes base^exponent mod modulus using the same repeated-squaring technique used in real-world cryptography.

How it works

Enter the base, exponent, and modulus. The calculator converts the exponent to binary and processes it bit by bit — squaring the running base value each step, and multiplying it into the result whenever that bit is 1 — taking the modulus after every multiplication to keep numbers small.

  1. Enter base.
  2. Enter exponent.
  3. Enter modulus.
  4. Click Calculate to see your results.

Examples

7^128 mod 13

7 raised to the 128th power, mod 13, equals 3 — computed using only about 7 multiplications instead of 128, thanks to repeated squaring.

Who should use it

  • Understanding how modular exponentiation and fast exponentiation work for a cryptography or number theory course.
  • Checking a hand-computed modular exponentiation result.

Industry applications

  • Cryptography and computer security education
  • Computer science and number theory coursework

Advantages

  • Uses the same efficient repeated-squaring algorithm real cryptographic systems rely on.
  • Shows the exponent's binary representation and the squaring trace step by step.

Limitations

  • Purely a calculation tool — doesn't implement a full cryptographic protocol like RSA itself.

Common mistakes to avoid

  • Assuming this calculator computes the literal (huge) value of base^exponent before taking the modulus — it never does, by design.
  • Confusing modular exponentiation with modular multiplication, which is just one step within this larger algorithm.

Best practices

  • For small exponents, verify the result by direct calculation to build confidence in how the algorithm works before trusting it on larger numbers.

Tips

  • Fast exponentiation (also called "exponentiation by squaring") is a foundational technique in computer science — the same divide-and-conquer idea shows up in fast matrix exponentiation and other algorithms too.

Frequently asked questions

Yes, with no signup and no limit on how many calculations you run.
For large exponents, base^exponent becomes an enormous number — far beyond what a computer can efficiently handle directly. Fast exponentiation keeps every intermediate value small by reducing modulo the modulus at each step.
It's the core operation behind RSA encryption, Diffie-Hellman key exchange, and many other public-key cryptography algorithms, which rely on modular exponentiation with very large numbers.
It only needs about log₂(exponent) multiplications instead of exponent multiplications — for a 128-bit exponent, that's roughly 128 steps instead of an astronomically large number of steps.

Get new calculators and guides in your inbox

No spam — just new tools like Modular Exponentiation Calculator and practical guides.

Favorites