Skip to content
TabKiwiTabKiwi

Modulo Calculator

a mod n with remainder, floored and Euclidean conventions compared, including for negative numbers.

UtilitiesRuns in your browser. Your files never leave this device.
Loading tool…

About this tool

Find the remainder and quotient of a division, and see how three common conventions differ when negative numbers are involved. This matters because % in JavaScript and C does not match % in Python or Excel's MOD(). Whole numbers of any size are computed exactly, and decimals work too.

How to use Modulo Calculator

  1. Enter the dividend a.
  2. Enter the divisor n.
  3. Compare the truncated, floored and Euclidean results.

Frequently asked questions

Why does −7 mod 3 give different answers in different languages?

Languages round the quotient differently. Truncating toward zero gives −1 (JavaScript, C), while flooring gives 2 (Python, Excel).

Which one is the mathematical modulo?

In number theory the result is usually taken between 0 and |n| − 1, which is the Euclidean convention.

Can the divisor be negative or a decimal?

Yes, both are supported. Only a divisor of 0 is rejected.

More Utilities tools

View all 78 →