CalculatorWallah logoCalculatorWallah

Power Mod Calculator

Calculate a^e mod m with normalized residues, binary exponent steps, and fast square-and-multiply verification.

Last Updated: May 2026

Power Mod Result

7

Normalized Base

7

Exponent Bits

4

Operations

3 multiply, 3 square

Power Mod Inputs

Enter a base, nonnegative exponent, and modulus greater than 1. The calculator uses square-and-multiply so large powers stay manageable.

Result Check

ItemCalculationResult
Expression7^13 mod 197
Base normalization7 mod 197
Binary exponent11014 bits
Fast methodSquare-and-multiply4 loop steps

Modular Rules

CheckRuleValue
Range check0 <= result < 19Pass
Negative base handlingBase is reduced before exponentiation7
Zero exponent rulea^0 mod mNot used
ComplexityO(log exponent)4 exponent bits

Square-and-Multiply Steps

Binary stepMultiply actionRunning resultNext square
Bit 0 = 11 x 7 mod 1977^2 mod 19 = 11
Bit 1 = 0Skip multiply for this bit711^2 mod 19 = 7
Bit 2 = 17 x 7 mod 19117^2 mod 19 = 11
Bit 3 = 111 x 11 mod 19711^2 mod 19 = 7

Number Theory Notice

This calculator is for integer modular arithmetic and educational number theory. For cryptographic production systems, use audited libraries and constant-time implementations rather than manual calculations.

Reviewed For Methodology, Labels, And Sources

Every CalculatorWallah calculator is published with visible update labeling, linked source references, and review of formula clarity on trust-sensitive topics. Use results as planning support, then verify institution-, policy-, or jurisdiction-specific rules where they apply.

Reviewed By

Jitendra Kumar, Founder & Editorial Standards Lead, reviews methodology, labels, assumptions, and trust-sensitive publishing decisions for this topic area.

Review editor profile

Topic Ownership

Sales tax and tax-sensitive estimate tools, Education and GPA planning calculators, Health, protein, and screening-formula pages, Platform-wide publishing standards and methodology

See ownership standards

Methodology & Updates

Page updated May 2026. Trust-critical pages are reviewed when official rates or rules change. Evergreen calculator guides are checked on a recurring quarterly or annual cycle depending on topic volatility.

How to Use the Power Mod Calculator

Enter the base, exponent, and modulus. The exponent must be zero or positive, and the modulus must be greater than 1.

The calculator reduces the base modulo m, converts the exponent into binary, and uses square-and-multiply to calculate the final remainder without expanding the full power.

  1. Step 1: Enter the base

    Use any integer, including a negative value.

  2. Step 2: Enter the exponent

    Use a nonnegative integer exponent.

  3. Step 3: Enter the modulus

    Use an integer modulus greater than 1.

  4. Step 4: Review the binary steps

    Check how each exponent bit affects the running result and next square.

How This Power Mod Calculator Works

Modular exponentiation finds the remainder of a power without expanding the full power. The calculator first reduces the base into the standard remainder range from 0 through m - 1.

It then reads the exponent in binary. Each loop squares the current factor modulo m. If the current binary digit is 1, the calculator also multiplies that factor into the running result.

Because every intermediate value is reduced modulo m, the method works efficiently even when the exponent is much larger than you would want to expand by hand.

Power Mod Guide

Core Formulas

ConceptFormulaUse
Power moda^e mod mThe remainder after raising a to e and dividing by m.
Normalize basea mod mReduce the base before repeated multiplication.
Square-and-multiplyread exponent bitsMultiply only when a binary exponent bit is 1.
Repeated squaringa, a^2, a^4, a^8, ... mod mKeeps every intermediate value bounded by m.
Zero exponenta^0 mod m = 1 mod mValid for modulus greater than 1.

Examples

ProblemResultNotes
7^13 mod 197Small example with several binary exponent steps.
42^17 mod 32332557RSA-style modular exponentiation example.
5^117 mod 9777Large exponent handled with repeated squaring.
(-12)^9 mod 358Negative base is normalized before powering.

Why Binary Exponents Help

A power such as a^117 does not need 116 repeated multiplications. Since 117 can be represented in binary, the calculator builds the needed powers a, a^2, a^4, a^8, and so on, reducing each one modulo m.

This is why power mod calculations are practical in cryptography and number theory: the number of loop steps grows with the number of binary digits in the exponent, not with the exponent itself.

Keep the research moving with Modulo Calculator, Inverse Modulo Calculator, Multiplicative Inverse Modulo Calculator, and Integer Calculator.

Frequently Asked Questions

Power mod means calculating a base raised to an exponent, then taking the remainder modulo m. It is written as a^e mod m.

Full powers can become extremely large. Modular exponentiation reduces after each multiplication, keeping intermediate values manageable.

The exponent is written in binary. The calculator repeatedly squares the current factor and multiplies it into the result only when the current exponent bit is 1.

Yes. The calculator first normalizes the base into the standard range from 0 to modulus - 1, then runs modular exponentiation.

This calculator uses nonnegative exponents. Negative exponents in modular arithmetic require modular inverse rules, which only work when the inverse exists.

It is used in number theory, cryptography examples, RSA-style calculations, primality tests, hashing, and cyclic remainder problems.

Related Calculators

Sources & References

  1. 1.Wolfram MathWorld - Modular Arithmetic(Accessed May 2026)
  2. 2.Wolfram MathWorld - Modular Exponentiation(Accessed May 2026)
  3. 3.Khan Academy - Modular Arithmetic(Accessed May 2026)