• Skip to primary navigation
  • Skip to main content
  • Skip to footer
Matemática Básica
  • Elementary School
  • High School
  • Financial Mathematics
  • Math Exercises
Home ❯ Elementary School

Modulo Calculator Online – Free

Enter the dividend (x) and the divisor (y) to calculate x mod y instantly. The calculator shows the remainder, the formula and the complete step-by-step.

Modulo Calculator

x mod y = r

x (dividend)
y (divisor)

Results

r (remainder)
Formula
x mod y = r

Step by step

    How to use the calculator

    1. Enter the dividend x — the number to be divided.
    2. Enter the divisor y — must be non-zero.
    3. The remainder r and the step-by-step appear automatically.
    4. Click Clear to reset.

    What is the modulo operator

    The modulo operator (written mod or %) returns the remainder of the integer division of x by y. The formula is:

    x mod y = x − y × floor(x / y)

    where floor is the floor function (rounds down). The result is always a value between 0 and |y| − 1.

    Examples

    x y r = x mod y Verification
    12 3 0 12 = 3 × 4 + 0
    17 5 2 17 = 5 × 3 + 2
    10 7 3 10 = 7 × 1 + 3
    −7 3 2 −7 = 3 × (−3) + 2
    100 13 9 100 = 13 × 7 + 9

    Uses of modulo in mathematics

    • Parity: n mod 2 = 0 (even) or 1 (odd).
    • Clock: hours in modulo 12 or 24.
    • Cryptography: RSA and other algorithms use modular arithmetic.
    • Hashing: index = key mod table size.
    • Divisibility: a divides b if b mod a = 0.

    Frequently asked questions

    What is the modulo operator?

    The modulo operator (mod or %) returns the remainder of the integer division of x by y. For example, 12 mod 5 = 2, since 12 = 5 × 2 + 2.

    How do you calculate x mod y manually?

    1. Divide x by y and find the integer quotient q = floor(x/y). 2. Multiply: q × y. 3. Subtract: r = x − q × y. Example: 17 mod 5 → q = 3 → r = 17 − 15 = 2.

    Can modulo be negative?

    In this calculator we use the Euclidean definition: the remainder is always ≥ 0. So −7 mod 3 = 2 (not −1). In some programming languages (C, Java) the result can be negative when x < 0.

    What is the difference between mod and remainder?

    For positive numbers they are identical. For negatives they differ: the Euclidean definition (mod) always returns a value ≥ 0, while "remainder" in some languages follows the sign of the dividend.

    Read also…

    • Division Remainder Calculator
    • GCD Calculator
    • Modular Multiplicative Inverse Calculator
    Jean Carlos Novaes

    About Jean Carlos Novaes

    I hold a degree in Computer Science from the Federal University of Bahia (2017) and am the editor and founder of this website.

    Footer

    Matemática Básica

    Basic Mathematics website with school content and solved exercises for Elementary and High School. Learn in an easy and efficient way!

    ABOUT

    • About us
    • Contact
    • Sitemap

    TOPICS

    • Elementary School
    • High School
    • Financial Mathematics
    • Math Exercises

    LEGAL

    • How to cite
    • Cookie Policy
    • Privacy Policy
    • Content License

    © 2015–2026 · Matemática Básica · All rights reserved.

    We use cookies for site functionality, analytics, and marketing, and to improve your experience.

    Cookie preferences