Modular Exponentiation Calculator (aᵇ mod m)

Compute aᵇ mod m for very large numbers with fast square-and-multiply — used in RSA and Diffie-Hellman.

Results

Enter your details and click Calculate to see your results.
About This Calculator

Square-and-multiply: walk through the exponent's binary digits, squaring each step and multiplying in the base when the bit is 1 — reducing mod m every time so numbers stay small.

Example

Example: 4¹³ mod 497 = 445.

Assumptions

Exact integer arithmetic (BigInt).

Frequently Asked Questions

Why not compute aᵇ first?

It can have millions of digits; reducing at every step keeps the work tiny.

Related Calculators

About the Author

Imran Hossain
Imran Hossain

Professional SEO, Digital Marketer Specialist

I am a Certified Google Ads Expert And Professional SEO, Digital Marketing Specialist

View full profile