Modulo & Remainder

Mathematics

Calculate integer division quotient, remainder, and mathematical modular congruence (a mod b). Essential for cryptography, clock arithmetic, and computer programming.

Calculated Result
2

a = 3 × b + 2

Quotient q
3
Formula: a = q·b + r

About this calculator

Modular arithmetic (often called clock arithmetic) forms the mathematical backbone of modern public-key cryptography (RSA, Diffie-Hellman), hashing algorithms, and cyclic scheduling in software systems.

This tool evaluates both standard truncated programming remainders and true Euclidean mathematical modulo, which always produces a non-negative result even for negative dividends.

How It Works & Formula

Formulaa = q·b + r, 0 ≤ r < |b|

Euclidean modulo computes r = a - b * floor(a / b), ensuring 0 ≤ r < |b|. Standard integer division computes quotient q = trunc(a / b) and remainder r_trunc = a % b.