Skip to content

Modular Arithmetic Calculator

Compute exact modular residues, multiplicative inverses and Chinese remainder solutions using BigInt arithmetic and pairwise-coprime validation.

Residue | modulus. Use pairwise coprime moduli of at least two, up to 20 rows.

Preparing calculator controls…

Results

Enter your inputs and calculate to see the result.

Runs in your browser — nothing you enter is sent to a server.

How the Modular Arithmetic Calculator works

The first two inputs calculate a normalized residue and an inverse, if one exists. The separate CRT worksheet solves simultaneous congruences and verifies the resulting residue for each modulus.

Compute exact modular residues, multiplicative inverses and Chinese remainder solutions using BigInt arithmetic and pairwise-coprime validation.

Formula

Normalize r = ((a mod m)+m) mod m. Extended Euclid gives a⁻¹ when gcd(a,m)=1. CRT merges residues modulo the product of coprime moduli.

Signed integers only, at most 30 digits per value and 20 congruences. Moduli must be at least two. This standard CRT mode rejects shared factors even when a generalized system might be consistent. These educational operations are not constant-time cryptographic implementations.

Examples

An inverse modulo eleven

For a=3 and m=11, the inverse is 4 because 3×4=12 leaves residue 1.

Three simultaneous residues

x=2 mod 3, x=3 mod 5 and x=2 mod 7 gives x=23 modulo 105. Every solution differs from 23 by a multiple of 105.

Frequently asked questions

What does this calculation assume?

The first two inputs calculate a normalized residue and an inverse, if one exists. The separate CRT worksheet solves simultaneous congruences and verifies the resulting residue for each modulus.

Which limitations matter for this tool?

Signed integers only, at most 30 digits per value and 20 congruences. Moduli must be at least two. This standard CRT mode rejects shared factors even when a generalized system might be consistent. These educational operations are not constant-time cryptographic implementations.

How can I check the result?

For a=3 and m=11, the inverse is 4 because 3×4=12 leaves residue 1. Compare this worked case before using your own inputs.

Information:

Good to know

Signed integers only, at most 30 digits per value and 20 congruences. Moduli must be at least two. This standard CRT mode rejects shared factors even when a generalized system might be consistent. These educational operations are not constant-time cryptographic implementations.

Reference: NIST DLMF: Chinese remainder theorem. The implementation scope and conventions above are authoritative for this worksheet.

GCD and LCM Calculator

Find the greatest common divisor and least common multiple of two or more numbers, with Euclid's steps.

Math Tools

Number Base Converter

Convert whole numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36, of any size.

Converters