Chinese Remainder Theorem Calculator

Enter up to 6 congruences and instantly find the unique solution x via the Chinese Remainder Theorem.

System of Congruences

Enter x ≡ r (mod m) for each row. All moduli must be pairwise coprime.

Examples

Enter congruences on the left and press Solve.

Summary

Enter up to 6 congruences and instantly find the unique solution x via the Chinese Remainder Theorem.

How it works

  1. Enter at least 2 rows of remainder r and modulus m (e.g. r=2, m=3 means x ≡ 2 mod 3).
  2. Click "Solve" — the tool checks that all moduli are pairwise coprime.
  3. For each congruence the tool computes the partial product Mi = M / mi and its modular inverse.
  4. The solution is x = Σ ri × Mi × Mi⁻¹ (mod M), reduced to the range [0, M).
  5. All intermediate values are shown so you can follow every step.

Use cases

  • Solving number theory homework and competition problems.
  • Cryptography: combining partial results from smaller moduli (RSA-CRT optimisation).
  • Calendar and scheduling puzzles that reduce to simultaneous remainders.
  • Checking understanding of the CRT proof by inspecting each intermediate step.
  • Computer science: fast multi-precision arithmetic via the CRT representation.
  • Puzzle solving: "What is the smallest number that leaves remainder a when divided by b?"

Frequently Asked Questions

Last updated: 2026-06-10 · Reviewed by Nham Vu