Maths & numbers

Chinese remainder solver

Solve compatible integer congruences, including non-coprime moduli.

Chinese remainder solver
Esc to restore

Your inputs

Results update as you type. Larger files run when you press Update result.

Your result

Your result will appear here.

More actions

Your inputs stay in this browser. Nothing is uploaded or saved.

A clear answer. Here’s how.

Combines up to 20 congruences using the extended Euclidean algorithm with exact BigInt arithmetic. Each modulus must be positive, and shared-factor congruences must be compatible. Returns the smallest non-negative solution and the combined least-common-multiple modulus. Input integers have at most 80 digits; the final modulus is bounded to 500 digits.

See a worked example

Worked example

A fixed demonstration, separate from the values you enter above.

One remainder,modulus pair per line
2,3
3,5
2,7

Example result

Smallest non-negative solution
23
Combined modulus
105

All solutions are x + k × combined modulus, for integer k. Compatible non-coprime moduli are supported with exact BigInt arithmetic.