• Skip to primary navigation
  • Skip to main content
  • Skip to footer
Matemática Básica
  • Elementary School
  • High School
  • Financial Mathematics
  • Math Exercises
Home ❯ High School

Free Online Modular Exponentiation Calculator

Calculate modular exponentiation xy mod n instantly. Enter the base, the exponent and the modulus to obtain the remainder efficiently with the binary exponentiation algorithm.

Modular Exponentiation Calculator

How to use the calculator

  1. In the x (base) field, enter the base (an integer).
  2. In the y (exponent) field, enter the exponent (a non-negative integer).
  3. In the n (modulus) field, enter the modulus (a positive integer, n ≥ 1).
  4. Select Calculate. The value of xy mod n will appear in the Result field.
  5. To start a new calculation, select Clear.

What is modular exponentiation?

Modular exponentiation calculates the remainder when xy is divided by n:

xy mod n = r

where r is the remainder when xy is divided by n, with 0 ≤ r < n.

This operation is fundamental to number theory and public-key cryptography (including RSA), where extremely large powers must be evaluated efficiently.

Fast modular exponentiation

Computing xy directly becomes impractical for large exponents. The binary exponentiation algorithm solves the problem in O(log y) operations by repeatedly squaring the base:

  • If y is even: xy = (xy/2)2
  • If y is odd: xy = x × xy−1

The modulus is applied at every step, keeping intermediate values small.

Modular exponentiation examples

x (base) y (exponent) n (modulus) xy mod n
2 10 7 2
3 4 5 1
5 3 13 8
7 0 10 1
2 100 1000000007 976371285

Frequently asked questions

What is modular exponentiation?

Modular exponentiation evaluates xy mod n: the remainder obtained when xy is divided by n. It is fundamental to cryptography and number theory.

How do I calculate xy mod n?

Enter the base x, exponent y, and modulus n, then select Calculate. The result is the remainder when xy is divided by n, computed with fast modular exponentiation.

Why is modular exponentiation used in cryptography?

Modular exponentiation underpins RSA and the Diffie–Hellman protocol. It is efficient in the forward direction but extremely hard to reverse through the discrete logarithm problem, a useful asymmetry for digital security.

What is 2¹⁰ mod 7?

2¹⁰ = 1024, and 1024 = 146 × 7 + 2. Therefore, 2¹⁰ mod 7 = 2.

What is the binary exponentiation algorithm?

It is an efficient method for calculating xy mod n by repeatedly halving the exponent. This reduces the number of operations from O(y) to O(log y), allowing enormous powers to be handled in a fraction of a second.

Related calculators and guides

  • Modular Multiplicative Inverse Calculator
  • Greatest Common Divisor Calculator
  • Square Root Calculator
  • Exponentiation: Properties and Examples
  • Prime Factorization Calculator
Jean Carlos Novaes

About Jean Carlos Novaes

I earned a degree in Computer Science from the Federal University of Bahia in 2017 and am the editor and founder of this website.

Footer

Matemática Básica

A mathematics website with clear lessons and worked exercises for elementary and high school students. Learn effectively, one step at a time.

INSTITUTIONAL

  • About us
  • Contact
  • Sitemap

SUBJECTS

  • Elementary School
  • High School
  • Financial Mathematics
  • Math Exercises

TRANSPARENCY

  • How to cite
  • Cookie Policy
  • Privacy Policy
  • Content License

© 2015–2026 · Matemática Básica · All rights reserved.