Skip to content

Free browser tools that respect your files: everything runs locally, nothing is uploaded.

Modulo Calculator

Calculate remainders with step-by-step solutions, modular arithmetic operations, negative number handling, and real-world applications.

Calculate Modulo

The number to be divided

The number to divide by (non-zero)

17 mod 5 = 2

17 = 3 x 5 + 2

Step-by-Step Solution

1

Given: 17 mod 5

2

Formula: a = q x b + r, where r is the remainder

4

Step 1: Divide 17 by 5

5

17 / 5 = 3.400000

7

Step 2: Take the integer part (quotient)

8

Quotient (q) = 3

10

Step 3: Calculate remainder

11

Remainder (r) = 17 - (3 x 5)

12

Remainder (r) = 17 - 15

13

Remainder (r) = 2

15

Result: 17 mod 5 = 2

Verification: 3 x 5 + 2 = 17 = 17

Try These Examples

Quick-start with common scenarios

Practice Modulo Problems

Test your skills with practice problems

Practice with 3 problems to test your understanding.

?What is Modulo?

The modulo operation (a mod b) finds the remainder when dividing a by b. For example, 17 mod 5 = 2 because 17 = 3 x 5 + 2. The formula is: a = q x b + r, where q is the quotient and r is the remainder. Modulo is used in clock arithmetic (13:00 mod 12 = 1), day calculations, cryptography, hash functions, and checking divisibility.

Your Results

Results are also pinned to the bottom of your screen.

Result

Remainder (mod)

2

Dividend17
Divisor5
Quotient3
Formula:

What is the Modulo Operation?

The modulo operation finds the remainder after division of one number by another. Written as a mod b or a % b, it returns r such that a = q x b + r where 0 <= r < |b|. Modular arithmetic is fundamental in computer science (array indexing, hash functions), cryptography (RSA encryption), and everyday applications like clock time and calendar calculations.

Key Facts About Modulo

  • a mod b = remainder when a is divided by b
  • 17 mod 5 = 2 because 17 = 3 x 5 + 2
  • Clock arithmetic: 15 mod 12 = 3 (3 o'clock)
  • Day of week: (current + days) mod 7
  • If a mod b = 0, then b divides a evenly
  • Different languages handle negatives differently
  • Modular addition: (a + b) mod n
  • Used in cryptography (RSA) and checksums

Frequently Asked Questions

What is the modulo operation?

The modulo operation (mod) finds the remainder when dividing one integer by another. For example, 17 mod 5 = 2 because 17 = 3 x 5 + 2, so the remainder is 2.

How does modulo work with negative numbers?

Different conventions exist. In JavaScript/C/Java (truncated division), -7 mod 3 = -1. In Python (floored division), -7 mod 3 = 2. The Euclidean definition always returns a non-negative remainder.

What is clock arithmetic?

Clock arithmetic is modulo 12 (or 24). If it's 10 o'clock and you add 5 hours, you get (10 + 5) mod 12 = 3 o'clock. This is why 13:00 = 1:00 PM.

Why is modulo used in cryptography?

Modular arithmetic is fundamental to RSA and other encryption algorithms. It provides one-way functions that are easy to compute forward but hard to reverse, making encryption secure.

How do I check if a number is divisible by another?

If a mod b = 0, then a is evenly divisible by b. For example, 15 mod 5 = 0 means 15 is divisible by 5. This is useful for checking even/odd (n mod 2), divisibility rules, and more.

Last updated: 2026-01-15

By Joseph OrdunaHow this works

How this works

Formulas follow standard definitions from the NIST Digital Library of Mathematical Functions and classical textbook derivations. Calculations run entirely in your browser. Where a closed-form solution exists, it is used; where an iterative or numerical method is required, the implementation is named on the page.

Sources

  1. [1]
    NIST Digital Library of Mathematical Functions
    Academicdlmf.nist.govAccessed Apr 21, 2026
Joseph Orduna
Founder & Software Engineer

Full-stack software engineer specializing in embedded systems, web architecture, and AI/ML. Founder of Practical Web Tools. Built the gesture-controlled drone IP acquired by KD Interactive (Aura Drone, sold on Amazon).