Chinese Remainder Theorem Calculator
Enter a system of congruences and get the solution with every step shown - modulus, inverses, and a check by substitution.
Runs entirely on your device - nothing is ever uploaded.
More tools
- LCM/GCF Calculator Least common multiple and greatest common factor. Get started
- Dilution Calculator C₁V₁ = C₂V₂ for any variable, with units. Get started
- GCF Calculator Greatest common factor of any numbers. Get started
- Molarity Calculator Mass, concentration and volume from MW. Get started
- LCM Calculator Least common multiple of any numbers. Get started
- Average Calculator Mean, median, mode and range from any list. Get started
- Prime Number Checker Test primality and find the first factor. Get started
- Standard Deviation Calculator Population and sample SD, with every step shown. Get started
How to use the CRT calculator
- Type each congruence as a remainder and a modulus (modulus at least 2).
- Add up to six congruences, or press Load example for the classic 3-5-7 system.
- Read the solution x and the combined modulus M - the answer updates as you type.
- Follow the numbered steps to see the modulus split, the inverses, and the substitution check.
What the colors mean
Each congruence owns one color, shown as the dot on its row. Every number derived from that equation - its M piece, its modular inverse, its term in the final sum, and its verification line - wears the same color. Black would leave you hunting through subscripts; the color code lets you trace each equation from input to answer at a glance.
Worked example
For x ≡ 2 (mod 3), x ≡ 3 (mod 5), x ≡ 2 (mod 7): M = 3 × 5 × 7 = 105. The pieces are M₁ = 35, M₂ = 21, M₃ = 15 with inverses y₁ = 2, y₂ = 1, y₃ = 1. Then x = (2·35·2 + 3·21·1 + 2·15·1) mod 105 = 233 mod 105 = 23, so x ≡ 23 (mod 105).
When there is no solution
With non-coprime moduli a system can contradict itself - for example x ≡ 1 (mod 2) and x ≡ 2 (mod 4), where one demands an odd number and the other an even one. The calculator reports exactly which equations clash and why, instead of a bare error.