Skip to content
D DocNectar

Free Chinese Remainder Theorem Calculator

Solve a system of simultaneous congruences (2 to 4 pairs) using the Chinese Remainder Theorem.

100% Free No Signup Works on all devices

Last updated October 10, 2026 · Report an error

Thanks for rating!

The Chinese Remainder Theorem solves systems of simultaneous modular equations — for example, finding a single number that leaves specific remainders when divided by several different, pairwise coprime numbers. This tool solves systems of 2 to 4 such congruences.

How it works

Given congruences x ≡ a_i (mod n_i) with pairwise coprime moduli, the theorem constructs the solution using N = the product of all moduli, N_i = N/n_i, and the modular inverse of each N_i mod n_i, then sums a_i × N_i × inverse_i and reduces modulo N.

  1. Enter remainder a₁.
  2. Enter modulus n₁.
  3. Enter remainder a₂.
  4. Enter modulus n₂.
  5. Enter remainder a₃ (optional).
  6. Enter modulus n₃ (optional).
  7. Enter remainder a₄ (optional).
  8. Enter modulus n₄ (optional).
  9. Click Calculate to see your results.

Examples

A classic textbook system

x ≡ 2 (mod 3), x ≡ 3 (mod 5), x ≡ 2 (mod 7) has the unique solution x = 23 (mod 105) — the smallest non-negative x satisfying all three congruences at once.

Who should use it

  • Cryptography and number theory coursework.
  • Scheduling problems involving repeating cycles of different, coprime lengths.

Industry applications

  • Cryptography (RSA-related computations)
  • Computer science (hashing, checksums)
  • Mathematics education

Advantages

  • Supports 2 to 4 simultaneous congruences.
  • Shows the full N_i / modular-inverse construction, not just the final answer.

Limitations

  • Requires pairwise coprime moduli — does not solve systems with shared-factor moduli (which may have no solution or require a modified approach).

Common mistakes to avoid

  • Entering moduli that share a common factor, which violates the pairwise-coprime requirement the theorem depends on.

Best practices

  • Always double check that all pairs of moduli are coprime before relying on the result — the tool validates this and will explain exactly which pair fails if not.

Tips

  • If your moduli aren't coprime, check whether the system is even solvable first (compatible remainders on the shared factors) before looking for another approach.

Frequently asked questions

The Chinese Remainder Theorem guarantees a unique solution modulo the product of the moduli only when every pair of moduli shares no common factor. If two moduli share a factor, the system may have no solution or the standard construction breaks down.
It means the solution is unique only up to multiples of N (the product of all the moduli) — adding or subtracting N from the answer gives another valid solution, and the tool reports the smallest non-negative one.

Get new calculators and guides in your inbox

No spam — just new tools like Chinese Remainder Theorem Calculator and practical guides.

Favorites