Modular Exponentiation

result : 5
5¹¹⁷ mod 19 = 5 (using fast exponentiation)

ABOUT THIS TOOL

Modular exponentiation is the computation of (baseexponent) mod modulus. It is a cornerstone of modern cryptography (RSA, Diffie‑Hellman), primality testing, and many areas of number theory. This calculator uses the efficient "exponentiation by squaring" method, which handles very large exponents without actually computing the enormous intermediate power. For example, 5¹¹⁷ mod 19 is computed in milliseconds, even though 5¹¹⁷ has more than 80 digits.

The tool accepts any integer base, non‑negative integer exponent, and positive modulus. It applies the binary expansion of the exponent to repeatedly square the base and reduce modulo the given number. This ensures that all intermediate values stay small and manageable, avoiding overflow. The step‑by‑step explanation shows the method, helping students understand the algorithm behind the scenes. This technique is sometimes called fast modular exponentiation and is essential in competitive programming and cryptography.

Beyond RSA, modular exponentiation appears in hash functions, digital signatures, and even in simple puzzles. With this calculator, you can verify textbook examples or experiment with large numbers. For instance, compute 7²⁵⁶ mod 13 or check that 3⁹⁰ mod 29 equals something. The result appears instantly, and the explanation summarizes the core idea (though for very large exponents we show the conceptual approach). All calculations are done with JavaScript's BigInt to maintain precision — the tool silently upgrades to BigInt when numbers exceed safe integer range, ensuring correct results for arbitrarily large inputs.

MultiCalculators designed this tool to be both educational and practical. Teachers can use it to demonstrate the power of modular arithmetic; engineers can quickly test values for cryptographic parameters; students can check homework. The interface is responsive, so it works on phones, tablets, or desktops. We purposely keep the design clean, with no distracting elements. The header includes essential links, but the footer has no navigation or copyright messages — just the tool you need. For feedback or feature requests, please visit our Contact Us page. Remember that modulus must be a positive integer, while exponent can be zero (result = 1 mod modulus).

We are continuously expanding our collection of math utilities. Modular exponentiation is just one of many tools available at MultiCalculators.org. Whether you are exploring Fermat's little theorem, working on Euler's theorem, or simply need a quick modular power, this calculator is here to help. The underlying algorithm runs in O(log exponent) time, making it extremely fast even for exponents with hundreds of digits. We hope this tool becomes your go‑to for modular exponentiation. Happy calculating!