Linear Congruence Solver (ax ≡ b mod m)
Solve ax ≡ b (mod m), count the solutions and list them all.
Runs in your browser. Your files never leave your device. See how to check
…
How to do it
- 1Step 1: Open Linear Congruence Solver (ax ≡ b mod m) and add your input
Type your numbers or text, add your file, or pick the options you need. Nothing is uploaded: everything stays in your browser.
- 2Step 2: What Linear Congruence Solver (ax ≡ b mod m) does
Solve ax ≡ b (mod m), count the solutions and list them all.
- 3Step 3: Read the result and compare
The result appears at once. Change one value to see how the answer moves, then keep the figure that fits your case.
- 4Step 4: Copy or save it
Copy the result or download it. For an important decision, confirm it with the official source or an adviser.
About this tool
Enter a, b and the modulus m. The calculator solves ax ≡ b (mod m) exactly, says how many solutions there are, gives the general solution and, when there are few, lists every solution modulo m.
Method
Let d = gcd(a, m). The congruence has a solution only if d divides b, and then there are exactly d solutions modulo m. Dividing through by d gives a congruence with a modular inverse; its solution x₀ repeats every m ÷ d.
Exact
Big-integer arithmetic is used, so the numbers can be as large as you like.
Worked example
14x ≡ 30 (mod 100): gcd 2 divides 30, so there are 2 solutions, x ≡ 45 (mod 50), that is 45 and 95.
Tips for best results
Check every box before you rely on a result, because one wrong digit changes the whole answer. Use the exact figures from your payslip, bill, certificate or contract, and keep a note of the date you calculated. Rates, thresholds and rules change from time to time, so for tax, fees and legal matters treat the output as an estimate and confirm with the official source named on this page. You can run as many scenarios as you like; nothing is saved or sent, and refreshing the page clears the boxes.
Quick facts
- Category: Math & Science
- Works in your browser, no sign-up, no upload.
- Your input stays on your device.
- Available in many languages.
- Content last reviewed:
Frequently asked questions
When is there no solution?
When gcd(a, m) does not divide b.
How many solutions are there?
gcd(a, m) of them modulo m.
What if a and m are coprime?
Exactly one solution, using the modular inverse of a.
How is the answer checked?
The tool shows a times x₀ reduced mod m next to b.
