Calculadora de Módulo

Calcula el resto de una división — la operación módulo

Modulo Calculator

Calculate the remainder of a division

Modulo Calculator

Find A mod B

Formula
A mod B = A - B x floor(A/B)

What is a Modulo Calculator?

A Modulo Calculator is a math tool that finds the remainder of a division. The modulo operation is written as a mod b (or sometimes a % b in programming). It tells you what’s left over when a is divided by b.

For example, when you divide 17 by 5, you get 3 with a remainder of 2. So: 17 mod 5 = 2. The modulo operation returns that remainder.

Modulo is used in many practical situations:

  • Determining if a number is even or odd (n mod 2)
  • Working with time and cycles (like clocks, repeating patterns)
  • Computer science tasks such as hashing, indexing, and cryptography
  • Finding repeating patterns in math (modular arithmetic)

This calculator makes it easy to compute remainders quickly, especially with large numbers.

How to Use This Modulo Calculator

  1. Enter the dividend (A) -- the number you want to divide (example: 17)
  2. Enter the divisor (B) -- the number you divide by (example: 5)
  3. Click 'Calculate' -- to compute the modulo result
  4. Review the result -- the output shows both the remainder (A mod B) and the quotient (how many times B fits into A)
  5. Try other values -- explore patterns like mod 2, mod 10, or mod 60

Tips:

  • The divisor B should not be 0 (division by zero is undefined)
  • Modulo is commonly used to 'wrap around' within a range (like 0–59 for minutes)
  • If you’re using negative numbers, different systems can handle modulo slightly differently—this calculator follows JavaScript’s convention consistently

Modulo Formulas

Division with Remainder

Any division can be expressed as:

a = b × q + r

a = dividend

b = divisor

q = quotient (whole number result)

r = remainder

Modulo Result

a mod b = r

The remainder from division

Remainder Range

0 ≤ r < |b|

Remainder is always less than the absolute value of b

Common Modulo Patterns

Even / Odd Check

n mod 2

0 → even, 1 → odd

Last Digit

n mod 10

Returns the last digit of n

Time Wrapping

minutes mod 60

Minute-hand position in a cycle

Example Calculations

Example 1: Basic Modulo

Compute: 17 mod 5

Division: 17 ÷ 5 = 3 remainder 2

Check: 5 × 3 = 15, and 17 − 15 = 2

Result: 17 mod 5 = 2

Example 2: Check Even or Odd

Compute: 29 mod 2

Division: 29 ÷ 2 = 14 remainder 1

Reasoning: Remainder is 1 → 29 is odd

Result: 29 mod 2 = 1

Example 3: Modulo 10 (Last Digit)

Compute: 347 mod 10

Division: 347 ÷ 10 = 34 remainder 7

Reasoning: The remainder matches the last digit

Result: 347 mod 10 = 7

Example 4: 'Wrap Around' Time

Problem: A digital clock uses a 12-hour cycle. It’s 9 o’clock now. What time is it in 8 hours?

Calculation: (9 + 8) = 17

Modulo: 17 mod 12 = 5

Result: 5 o’clock

Frequently Asked Questions

What does 'mod' mean?

'Mod' means modulo, which returns the remainder after division. For example, 10 mod 3 = 1 because 10 ÷ 3 leaves a remainder of 1.

Is modulo the same as division?

Not exactly. Division gives the quotient (how many times a number fits), while modulo gives the remainder. You often use them together when you need both the quotient and what’s left over.

Why is modulo useful?

Modulo is useful for repeating cycles (time, rotations, repeating patterns), checking even/odd, limiting values to a range (like 0–59), and many programming and math applications.

What happens if the divisor is 0?

Modulo by 0 is undefined, because division by 0 is undefined. The calculator will not return a result if you enter 0 as the divisor.

How does modulo work with negative numbers?

Different systems define negative modulo differently (some use the sign of the dividend, some the divisor). If you use negative numbers, make sure you understand the convention used by the calculator and keep it consistent in your work.

Embed This Modulo Calculator on Your Website

Want to add this modulo calculator to your website? Get a custom embed code that matches your site's design and keeps visitors engaged.

Responsive design
Custom styling
Fast loading
Mobile optimized

¿Qué es la operación módulo?

La operación módulo encuentra el residuo cuando un número se divide por otro. Se escribe como a mod n (o a % n en programación) y devuelve lo que sobra después de dividir a entre n tantas veces como sea posible. Por ejemplo, 17 mod 5 = 2 porque 17 = 3×5 + 2. El resultado siempre es un número entero no negativo menor que el divisor — así que mod 5 siempre da un valor entre 0 y 4.

El módulo aparece en todas partes de la programación: verificar si un número es par (n % 2 == 0), rotar por una lista de opciones (índice % longitud), construir funciones hash y aritmética de reloj (el tiempo da vuelta en 12 o 24). Es una de las operaciones más útiles en ciencias de la computación. Esta calculadora admite entradas positivas y negativas y muestra el desglose completo del cálculo.

Cómo usar la calculadora de módulo

  1. Ingresa el dividendo — el número que se va a dividir (a).
  2. Ingresa el divisor — el módulo (n).
  3. Haz clic en Calcular.
  4. Lee el residuo — ese es tu resultado módulo.

Fórmula y ejemplos

a mod n = a − n × floor(a / n) Ejemplos: 17 mod 5 = 2 (17 = 3×5 + 2) 20 mod 4 = 0 (20 = 5×4 + 0, división exacta) 7 mod 3 = 1 (7 = 2×3 + 1) Verificar par/impar: n mod 2 = 0 → par n mod 2 = 1 → impar Aritmética de reloj (12 horas): 14 mod 12 = 2 → 2:00 PM

El resultado de a mod n siempre cumple 0 ≤ resultado < n (para n positivo). El comportamiento con números negativos varía según el lenguaje de programación: algunos usan división suelo (Python) y otros usan división truncada (C, Java, JavaScript), que puede producir restos negativos.

Ejemplos del mundo real

100 mod 7 = 2

100 = 14×7 + 2. Útil para distribuir 100 elementos en 7 grupos — tendrías 14 grupos completos con 2 elementos sobrando.

256 mod 16 = 0

256 es múltiplo exacto de 16, así que el residuo es 0. Esto aparece constantemente en matemática hexadecimal y binaria — las potencias de 2 se dividen entre sí sin dejar resto.

29 mod 12 = 5

Aritmética de reloj: 29 horas después del mediodía son las 5:00 AM del día siguiente. La operación módulo es lo que hace que los cálculos de tiempo circular funcionen.

Preguntas frecuentes

¿Qué significa mod en programación?
En la mayoría de los lenguajes de programación, el operador % es el operador módulo (o resto). Por ejemplo, 10 % 3 devuelve 1 porque 10 dividido entre 3 deja un residuo de 1. Se usa constantemente para verificar divisibilidad, envolver índices y ciclar valores.
¿Cuál es la diferencia entre módulo y resto?
Con números positivos son idénticos. La diferencia aparece con números negativos. El módulo matemático siempre devuelve un resultado no negativo (división suelo), mientras que el resto en programación puede ser negativo (división truncada). Por ejemplo, -7 mod 3 = 2 matemáticamente, pero -7 % 3 = -1 en JavaScript y C.
¿Qué dice mod 2 sobre un número?
n mod 2 es la prueba más rápida de par/impar. Si el resultado es 0 el número es par; si es 1 es impar. Este es el uso más común del módulo en programación cotidiana y una de las primeras cosas que aprenden los principiantes.
¿Por qué el módulo es útil en arreglos circulares?
Cuando necesitas recorrer un arreglo repetidamente, puedes usar índice % longitud para dar vuelta automáticamente. Cuando el índice llega al final se reinicia a 0, creando un ciclo sin fin sin lógica de casos especiales. Este patrón se usa en carruseles, planificadores round-robin y buffers circulares.
¿Cómo se usa el módulo en criptografía?
El módulo es el núcleo de la criptografía de clave pública. El cifrado RSA se basa en la exponenciación modular — elevar números a grandes potencias mod un primo grande. El intercambio de claves Diffie-Hellman y la criptografía de curva elíptica dependen del hecho de que la aritmética modular es fácil de calcular en una dirección pero extremadamente difícil de revertir.