Chinese remainder theorem calculator

Solve two simultaneous integer congruences, including non-coprime moduli.

Enter values

Start with the example below, or enter your own values.

How it works

Check compatibility modulo the gcd of the moduli, then solve the reduced congruence. Return the least nonnegative solution and combined modulus.

Try an example

First residue: 2; First modulus: 3; Second residue: 3; Second modulus: 5. The form starts with these values; change them to explore your own case.

Example result: 8

  1. Solve the reduced congruence using extended GCD.

Learn more in Exact number theory and congruences.

Results are calculated locally. Floating-point tools provide numerical approximations, not formal proof certificates.