# Modulo Calculator

> Calculate the remainder of any division operation (X mod Y). Supports negative numbers and shows step-by-step work.

- Open the tool: https://overtooled.com/modulo-calculator
- Category: Math & Finance
- Privacy: Runs entirely in your browser. Nothing is uploaded, no account is needed, and it works offline once loaded.
- Price: free, no sign-up
- Keywords: modulo, mod, remainder, division, math

## In short

Calculate remainders (X mod Y) with step-by-step work.

## Overview

Computes X mod Y, the remainder after division, together with the integer quotient and the identity X = Q x Y + R. It shows both common conventions side by side -- floored mod (math, Python, Excel) and truncated remainder (JavaScript, C, Java %) -- which differ only when an input is negative. Handy for programming, clock arithmetic and checking divisibility.

## Features

- Floored mod: quotient rounded down, remainder takes the sign of the divisor (-7 mod 3 = 2, since -7 = -3 x 3 + 2)
- Truncated remainder: quotient rounded toward zero, remainder takes the sign of the dividend, like JavaScript % (-7 % 3 = -1, since -7 = -2 x 3 - 1)
- Each result has its own quotient and an equation line "X = Q x Y + R" that always balances, plus copy and Pipeline buttons
- A note says whether the two conventions agree for the current inputs
- Accepts decimals and negative numbers; live results; floating-point noise is trimmed for display
- "Cannot divide by zero" message when Y is 0

## How to use it

1. Enter the dividend X.
2. Enter the divisor Y.
3. Read the remainder under the convention you need, with its quotient and equation.

## Inputs

- Two numbers X and Y (Y not zero); decimals and negatives allowed

## Outputs

- Floored and truncated remainders, each with its integer quotient and X = Q x Y + R equation

## Limits and notes

- In a Pipeline the tool outputs the truncated (JavaScript %) remainder
- Decimal inputs with up to 15 decimal places are computed exactly on scaled integers (0.3 mod 0.1 = 0, 5.5 mod 0.1 = 0); results display to 12 significant digits
- Nothing is saved; runs entirely in the browser

## Questions and answers

### How does the Modulo Calculator work?

The tool computes the remainder under both common conventions and shows them side by side. Floored mod rounds the quotient down, so the remainder takes the sign of the divisor, like math, Python % and Excel MOD (-7 mod 3 = 2). Truncated remainder rounds the quotient toward zero, so the remainder takes the sign of the dividend, like JavaScript, C and Java % (-7 % 3 = -1). Each result shows its own integer quotient and an equation X = Q x Y + R that always balances; for two positive numbers both give the same answer.

### What does modulo mean?

Modulo (or mod) gives the remainder after dividing one number by another. For example, 10 mod 3 = 1, because 10 divided by 3 is 3 with a remainder of 1.

### How does modulo work with negative numbers?

It depends on the convention, so the tool shows both. Floored mod (math, Python, Excel) gives -7 mod 3 = 2, because -7 = -3 x 3 + 2; the result takes the sign of the divisor. Truncated remainder (JavaScript, C, Java %) gives -7 % 3 = -1, because -7 = -2 x 3 - 1; the result takes the sign of the dividend. A note says whether the two agree for your inputs.

### What is modulo used for in programming?

Common uses include checking if a number is even or odd (n % 2), cycling through array indices, implementing circular buffers, time calculations (e.g., converting seconds to minutes), and hash table indexing.

## Related tools

- [Calculator](https://overtooled.com/calculator.md): Calculator with keyboard shortcuts, history, and memory
- [Prime Number Checker](https://overtooled.com/prime-number-checker.md): Check if a number is prime and see its factorization
- [Compound Interest Calculator](https://overtooled.com/compound-interest.md): Calculate investment growth with compound interest and regular contributions
- [Cooking Unit Converter](https://overtooled.com/cooking-converter.md): Convert between cups, tablespoons, grams, milliliters, and ounces

---
Overtooled: 179 free tools that run in your browser. Index of all tools: https://overtooled.com/llms.txt
