You can easily do this in a calculator by dividing the exponent into pieces.

For example: Let's say we have to calculate .

Divide 23 into as many pieces as you want, for example . The bigger the exponent, more the numbers you should divide it in. Now, calculate , and (All three of which can easily be calculated using your method in any calculator).

Now multiply all the three values, , and take its mod with again. The final answer will give you your answer. So, $112 x 118 x 118 = 1559488$

$1559488\ mod\ 221 = 112$ which is the correct answer for .

Answer from p sin on Stack Exchange
🌐
Boxentriq
boxentriq.com › home › math › modular exponentiation
Modular Exponentiation Calculator | Boxentriq
Computes a^b mod n efficiently for RSA math, crypto challenges, and modular arithmetic.
Discussions

How to calculate the modulus of a big number on a calculator? - Mathematics Stack Exchange
I would like to calculate the modulus of a large number using my calculator. Considering my calculator does not support the modulus operator, I have no other choice than using this method: To Calc... More on math.stackexchange.com
🌐 math.stackexchange.com
October 17, 2016
math - How to calculate modulus of large numbers? - Stack Overflow
How to calculate modulus of 5^55 modulus 221 without much use of calculator? I guess there are some simple principles in number theory in cryptography to calculate such things. More on stackoverflow.com
🌐 stackoverflow.com
modular arithmetic - How do you calculate the modulo of a high-raised number? - Mathematics Stack Exchange
Stack Exchange network consists ... the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange ... Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... I can't calculate $439^{223}$ since it's a very big number, there must ... More on math.stackexchange.com
🌐 math.stackexchange.com
September 14, 2012
Does anyone have a recommended online modulus calculator that works with very large numbers?
Not online, but if this solution is valid, bc can do it. $ bc bc 1.07.1 Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. (152015^(154993)) % 262631 220160 More on reddit.com
🌐 r/calculators
2
3
February 25, 2021
People also ask

How to calculate modulo division?

To calculate modulo division: subtract the divisor from the dividend until the resultant is less than the divisor.

🌐
omnicalculator.com
omnicalculator.com › math › modulo
Modulo Calculator
How do I calculate exponential modulo?

If the numbers at hand are not very big, you can simply solve the exponent first and then apply the modulo. Otherwise, you either need to apply some smart reasoning, a math theorem (like Fermat's little theorem or Euler's theorem), or a specialized computer algorithm that performs fast modular exponentiation.

🌐
omnicalculator.com
omnicalculator.com › math › power-modulo
Power Mod Calculator
What is a modulo operator?

The modulo operator is used to find the remainder during a division of two numbers. The operator is represented by the symbol % in most programming languages. It is also known as the remainder operator. As an example, 5 mod 2 returns 1.

🌐
omnicalculator.com
omnicalculator.com › math › modulo
Modulo Calculator
🌐
Omni Calculator
omnicalculator.com › math › power-modulo
Power Mod Calculator
October 3, 2025 - Omni's power mod calculator is here to help whenever you need to compute powers in modular arithmetic. It uses one of the fast modular exponentiation algorithms, so there's no risk of facing the problem of overflow.
🌐
CalculatorSoup
calculatorsoup.com › calculators › math › modulo-calculator.php
Modulo Calculator
1 mod 2 is a situation where the ... as the remainder. For positive numbers, whenever the divisor (modulus) is greater than the dividend, the remainder is the same as the dividend....
🌐
Omni Calculator
omnicalculator.com › math › modulo
Modulo Calculator
May 8, 2025 - All you have to do is input the initial number x and integer y to find the modulo number r, according to x mod y = r. Read on to discover what modulo operations and modulo congruence are, how to calculate modulo and how to use this calculator correctly.
Find elsewhere
🌐
DCode
dcode.fr › mathematics › arithmetics › modular exponentiation
Modular Exponentiation Calculator - Power Mod - Online Modulo
In practice, it is preferable to reduce modulo $ n $ at each step of the calculation using the property $ x \equiv y \mod n $, alors $ x \cdot z \equiv y \cdot z \mod n $ This property makes it possible to perform intermediate reductions and avoid the manipulation of gigantic numbers.
Top answer
1 of 10
106

Okay, so you want to calculate a^b mod m. First we'll take a naive approach and then see how we can refine it.

First, reduce a mod m. That means, find a number a1 so that 0 <= a1 < m and a = a1 mod m. Then repeatedly in a loop multiply by a1 and reduce again mod m. Thus, in pseudocode:

a1 = a reduced mod m
p = 1
for(int i = 1; i <= b; i++) {
    p *= a1
    p = p reduced mod m
}

By doing this, we avoid numbers larger than m^2. This is the key. The reason we avoid numbers larger than m^2 is because at every step 0 <= p < m and 0 <= a1 < m.

As an example, let's compute 5^55 mod 221. First, 5 is already reduced mod 221.

  1. 1 * 5 = 5 mod 221
  2. 5 * 5 = 25 mod 221
  3. 25 * 5 = 125 mod 221
  4. 125 * 5 = 183 mod 221
  5. 183 * 5 = 31 mod 221
  6. 31 * 5 = 155 mod 221
  7. 155 * 5 = 112 mod 221
  8. 112 * 5 = 118 mod 221
  9. 118 * 5 = 148 mod 221
  10. 148 * 5 = 77 mod 221
  11. 77 * 5 = 164 mod 221
  12. 164 * 5 = 157 mod 221
  13. 157 * 5 = 122 mod 221
  14. 122 * 5 = 168 mod 221
  15. 168 * 5 = 177 mod 221
  16. 177 * 5 = 1 mod 221
  17. 1 * 5 = 5 mod 221
  18. 5 * 5 = 25 mod 221
  19. 25 * 5 = 125 mod 221
  20. 125 * 5 = 183 mod 221
  21. 183 * 5 = 31 mod 221
  22. 31 * 5 = 155 mod 221
  23. 155 * 5 = 112 mod 221
  24. 112 * 5 = 118 mod 221
  25. 118 * 5 = 148 mod 221
  26. 148 * 5 = 77 mod 221
  27. 77 * 5 = 164 mod 221
  28. 164 * 5 = 157 mod 221
  29. 157 * 5 = 122 mod 221
  30. 122 * 5 = 168 mod 221
  31. 168 * 5 = 177 mod 221
  32. 177 * 5 = 1 mod 221
  33. 1 * 5 = 5 mod 221
  34. 5 * 5 = 25 mod 221
  35. 25 * 5 = 125 mod 221
  36. 125 * 5 = 183 mod 221
  37. 183 * 5 = 31 mod 221
  38. 31 * 5 = 155 mod 221
  39. 155 * 5 = 112 mod 221
  40. 112 * 5 = 118 mod 221
  41. 118 * 5 = 148 mod 221
  42. 148 * 5 = 77 mod 221
  43. 77 * 5 = 164 mod 221
  44. 164 * 5 = 157 mod 221
  45. 157 * 5 = 122 mod 221
  46. 122 * 5 = 168 mod 221
  47. 168 * 5 = 177 mod 221
  48. 177 * 5 = 1 mod 221
  49. 1 * 5 = 5 mod 221
  50. 5 * 5 = 25 mod 221
  51. 25 * 5 = 125 mod 221
  52. 125 * 5 = 183 mod 221
  53. 183 * 5 = 31 mod 221
  54. 31 * 5 = 155 mod 221
  55. 155 * 5 = 112 mod 221

Therefore, 5^55 = 112 mod 221.

Now, we can improve this by using exponentiation by squaring; this is the famous trick wherein we reduce exponentiation to requiring only log b multiplications instead of b. Note that with the algorithm that I described above, the exponentiation by squaring improvement, you end up with the right-to-left binary method.

a1 = a reduced mod m
p = 1
while (b > 0) {
     if (b is odd) {
         p *= a1
         p = p reduced mod m
     }
     b /= 2
     a1 = (a1 * a1) reduced mod m
}

Thus, since 55 = 110111 in binary

  1. 1 * (5^1 mod 221) = 5 mod 221
  2. 5 * (5^2 mod 221) = 125 mod 221
  3. 125 * (5^4 mod 221) = 112 mod 221
  4. 112 * (5^16 mod 221) = 112 mod 221
  5. 112 * (5^32 mod 221) = 112 mod 221

Therefore the answer is 5^55 = 112 mod 221. The reason this works is because

55 = 1 + 2 + 4 + 16 + 32

so that

5^55 = 5^(1 + 2 + 4 + 16 + 32) mod 221
     = 5^1 * 5^2 * 5^4 * 5^16 * 5^32 mod 221
     = 5 * 25 * 183 * 1 * 1 mod 221
     = 22875 mod 221
     = 112 mod 221

In the step where we calculate 5^1 mod 221, 5^2 mod 221, etc. we note that 5^(2^k) = 5^(2^(k-1)) * 5^(2^(k-1)) because 2^k = 2^(k-1) + 2^(k-1) so that we can first compute 5^1 and reduce mod 221, then square this and reduce mod 221 to obtain 5^2 mod 221, etc.

The above algorithm formalizes this idea.

2 of 10
31

To add to Jason's answer:

You can speed the process up (which might be helpful for very large exponents) using the binary expansion of the exponent. First calculate 5, 5^2, 5^4, 5^8 mod 221 - you do this by repeated squaring:

 5^1 = 5(mod 221)
 5^2 = 5^2 (mod 221) = 25(mod 221)
 5^4 = (5^2)^2 = 25^2(mod 221) = 625 (mod 221) = 183(mod221)
 5^8 = (5^4)^2 = 183^2(mod 221) = 33489 (mod 221) = 118(mod 221)
5^16 = (5^8)^2 = 118^2(mod 221) = 13924 (mod 221) = 1(mod 221)
5^32 = (5^16)^2 = 1^2(mod 221) = 1(mod 221)

Now we can write

55 = 1 + 2 + 4 + 16 + 32

so 5^55 = 5^1 * 5^2 * 5^4 * 5^16 * 5^32 
        = 5   * 25  * 625 * 1    * 1 (mod 221)
        = 125 * 625 (mod 221)
        = 125 * 183 (mod 183) - because 625 = 183 (mod 221)
        = 22875 ( mod 221)
        = 112 (mod 221)

You can see how for very large exponents this will be much faster (I believe it's log as opposed to linear in b, but not certain.)

🌐
Emathcalculator
emathcalculator.com › en › calculators › algebra › powerMod.php
PowerMod Calculator - Online Tool (with steps)
Online PowerMod Calculator. The PowerMod Calculator, or Modular Exponentiation Calculator, calculates online a^b mod n step-by-step
🌐
Calculators.org
calculators.org › math › modulo.php
Modulo Calculator
Modulo is also referred to as ‘mod.’ · The standard format for mod is: a mod n Where a is the value that is divided by n. For example, you’re calculating 15 mod 4. When you divide 15 by 4, there’s a remainder. 15 / 4 = 3.75 · Instead of its decimal form (0.75), when you use the mod ...
🌐
MiniWebtool
miniwebtool.com › home page › math › basic math operations › modulo calculator
Modulo Calculator - Calculate Remainder with Visual Division Breakdown
January 5, 2026 - Negative numbers can be tricky because different systems define modulo differently. This calculator uses the mathematical definition where the remainder is always non-negative (0 to |n|-1): -17 mod 5 = 3 (not -2), because -17 = 5 × (-4) + 3 ... These properties are essential in cryptography and computer science, allowing calculations with very large numbers without overflow.
🌐
PlanetCalc
planetcalc.com › 8326
Online calculator: Modular arithmetic
You may also enter the math expression containing other integers and the following modular arithmetic operations: + addition modulo p - subtraction modulo p * multiplication modulo p / division modulo p (available for all numbers if the modulus is a prime number only) ^ exponentiation modulo p () brackets for math expression grouping · All operations will be carried out taking a modulus into account. Even more - if you click "show details" options, you will see a solution step by step - with the result of each modular arithmetic operation used in the math expression. By the way, did you know that modular arithmetic is sometimes called clock arithmetic? This is because like a clock resets itself to zero at midnight, the number resets itself each time the modulus, or mod is reached, so it wraps around a modulus.
Top answer
1 of 5
31

There are often tricks to this if the numbers are nice enough, but even if they're not, here's a way that's not entirely horrible.

You already know what 439 is mod 713. What is $439^2 \mod 713$? What about $439^4$? (Hint: take your answer for $439^2$ after reducing it mod 713, and then square it again.) In the same way, calculate $439^8, 439^{16}, \dots, 439^{128} \mod 713$. Now just note that 233 = 128 + 64 + 32 + 8 + 1. So multiply the appropriate powers of 439 together - again, one calculation at a time, reducing mod 713 each time.

Now you should only have to do 11 calculations, and now all your numbers are 6 digits or less. Rather than impossible, it's now simply tedious. :)

By the way, one thing to notice: 713 = 23 * 31. Perhaps your calculations will be easier if you do them mod 23 and 31, then apply the Chinese remainder theorem?

2 of 5
12

$713=23\cdot 31$

$439 \pmod {23}=2$ and $\phi(23)=22$ and $233\equiv 13{\pmod {22}}$

So, $439^{223} {\pmod {23}} \equiv 2^{22\cdot 10 + 13}\equiv {(2^{22})}^{10}2^{13}\equiv 2^{13} {\pmod {23}}$ using Euler's Totient Theorem.

$2^6\equiv 18 {\pmod {23}}, 2^7\equiv 36 \equiv 13$

$\implies 2^{13}\equiv 18\cdot 13=234\equiv 4 {\pmod {23}}=4+23x$ for some integer $x$.

$439 \pmod {31}=5$ and $\phi(31)=30$ and $233\equiv 23{\pmod {30}}$

So, $439^{223} {\pmod {31}} \equiv 5^{23} {\pmod {31}}$

$5^3 \equiv 1 {\pmod {31}} \implies 5^{23}\equiv({5^3})^7 5^2\equiv 5^2{\pmod {31}}=25+31y$ for some integer $y$.

So, we need to find $z$ such that $z=25+31y=4+23x$

Expressing as continued fraction, $$\frac{31}{23}=1+\frac{8}{23}=1+\frac{1}{\frac{23}{8}}=1+\frac{1}{2+\frac{7}{8}}$$

$$=1+\frac{1}{2+\frac{1}{\frac{8}{7}}}=1+\frac{1}{2+\frac{1}{1+\frac{1}{7}}}$$

So, the last but one convergent is $$1+\frac{1}{2+\frac{1}{1}}=\frac{4}{3}$$

So, $23\cdot 4- 31\cdot 3=-1$

$25+31y=4+23x\implies 23x=31y+21(31\cdot 3-23\cdot 4)$ $\implies 23(x+84)=31(y+63)$ $$\implies x+84=\frac{31(y+63)}{23}$$

So, $23\mid (y+63)$ as $x+84$ is integer and $(31,23)=1$ i.e., $ 23\mid (y+69-6)\implies 23\mid (y-6) \implies y=6+23w$

So, $z=25+31y=25+31(6+31w)=713w+211 \equiv 211 {\pmod {713}}$

🌐
GeeksforGeeks
geeksforgeeks.org › dsa › how-to-compute-mod-of-a-big-number
How to compute mod of a big number? - GeeksforGeeks
April 10, 2023 - // Java program to compute mod of a big // number represented as string import java.io.*; class GFG { // Function to compute num (mod a) static int mod(String num, int a) { // Initialize result int res = 0; // One by one process all digits of 'num' for (int i = 0; i < num.length(); i++) res = (res * 10 + num.charAt(i) - '0') % a; return res; } // Driver program public static void main(String[] args) { String num = "12316767678678"; System.out.println(mod(num, 10)); } } // This code is contributed by vt_m.
🌐
DCode
dcode.fr › mathematics › arithmetics › modulo n calculator
Modulo Calculator - Mod N % - Online Modulus Finder
However, N be a natural number. Method 2: Perform the integer division and calculate the value of the difference. Example: Calculate $ A=123 $ modulo $ N=4 $, make the division: $ 123/4 = 30.75 $. Keep the integer part $ 30 $, and multiply by ...
🌐
YouTube
youtube.com › snugglyhappymathtime
Finding Modulo for Large Numbers - YouTube
At some point you can make numbers large enough that computers have a hard time takings modulo on them. There's a neat little way to do this using exponents.
Published   April 24, 2020
Views   15K
🌐
YouTube
youtube.com › watch
How to calculate MOD of bigger number in 5-10 secs??
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.