Skip to content

Modulo Calculator

Remainder after division.

Reviewed by the Calculation Machine team · How we check our maths

Your values

ⓘ Live results

Results
a mod n
3
Programming remainder (a % n)
3
Quotient (floor)
6
Exact division
6.75
Divides evenly?
No

Quick answer

The modulo operation returns the remainder left after dividing one number by another.

The formula

a mod n = a − n⌊a/n⌋

Worked example

Worked example

Using the values the calculator loads with.

Inputs

  • Dividend a27
  • Divisor n4

Result

  • a mod n3
  • Programming remainder (a % n)3
  • Quotient (floor)6
  • Exact division6.75
  • Divides evenly?No

How to use the Modulo Calculator

  1. 1Enter the number being divided.
  2. 2Enter the divisor.
  3. 3Compare the true modulus with the programming remainder.

Frequently asked questions

Why do negatives differ?

Most programming languages keep the sign of the dividend; mathematics returns a non-negative result.

What is modulo used for?

Clock arithmetic, hashing, cycling through lists and checking divisibility.

About this calculator