Math

Modular Exponentiation Calculator

Compute a large integer power modulo a positive integer without constructing the full power.

Exact method explained belowEditable inputs
Calculation notebook
Calculation notebook

The formula and worked example below explain the calculation.

See the method

Enter your values

Runs on your device

Your answer

Your result

Let’s calculate.

Use the Calculate button to see your result.

Review the method below for assumptions and conventions.

How to use this tool

  1. Enter base, nonnegative exponent, positive modulus.
  2. Select Calculate to view the result.
  3. Check the method and assumptions below before using the result.

The method, explained

Repeated squaring reduces each product modulo m while processing exponent bits. This computes a^e mod m with bounded intermediate integer values.

A WORKED EXAMPLE

Using base = 7, nonnegative exponent = 128, positive modulus = 13, the result is 3. Change these example inputs to match your task; use the method above to check each step.

Understanding your result

No. Reducing after every multiplication gives the same remainder while avoiding the memory cost of representing the full integer power.

What to keep in mind

At most 200 digits per input. Educational arithmetic; not a constant-time cryptographic implementation. Finite-precision arithmetic is used. Check the domain and the stated convention before using an approximation.

Common questions

Does it calculate the enormous power first?

No. Reducing after every multiplication gives the same remainder while avoiding the memory cost of representing the full integer power.

How can I check the result?

Repeated squaring reduces each product modulo m while processing exponent bits. This computes a^e mod m with bounded intermediate integer values. The worked example uses editable inputs. Calculations run on your device; no external API or account is required.

Methodology maintained by ClarityKit. How these tools are built and checked.