BINARIOS.ORG Number Tools & Mathematics
Free online calculator

Modular Arithmetic Calculator

Calculate modular addition, subtraction, multiplication, exponentiation, remainders, and congruences. Supports negative integers and provides step-by-step explanations.

Addition Subtraction Multiplication Powers Congruences Negative integers

Calculator

Enter integers and submit the form to calculate.

Must be a positive integer.

What is modular arithmetic?

Modular arithmetic works with remainders after division by a positive integer called the modulus. Two integers are congruent modulo n if their difference is divisible by n.

Modular addition

(a + b) mod n

Example: (17 + 12) mod 5 = 4.

Modular subtraction

(a - b) mod n

Example: (3 - 10) mod 7 = 0.

Modular multiplication

(a × b) mod n

Example: (8 × 9) mod 7 = 2.

Modular exponentiation

a^b mod n

Example: 3^4 mod 7 = 4. Repeated squaring avoids calculating the full power.

Congruences

a ≡ b (mod n)

Example: 17 ≡ 3 (mod 7), because their difference is divisible by 7.

Negative integers

-17 mod 5 = 3

The calculator returns the least nonnegative remainder, between 0 and n - 1.

Frequently asked questions

What does mod mean?

Mod gives the remainder after division. For example, 23 mod 6 = 5.

Can I use negative numbers?

Yes. Negative integers are supported, and the calculator normalizes the remainder to a nonnegative value.

What is a congruence?

Two integers are congruent modulo n when their difference is divisible by n.

Are negative exponents supported?

No. This version accepts nonnegative exponents. Negative modular exponents require a modular inverse.