Modular Arithmetic (Clock) Calculator

This modular arithmetic calculator works out what a number becomes when you wrap it around a clock of any size, the everyday idea behind telling the time past twelve or counting days of the week. You enter a number (n) and a modulus (m), and the calculator returns the least non-negative residue, the value left over once every full cycle of m has been removed, shown as a clear n mod m equals result statement. Alongside that main result you get the number of full cycles the value completes and the modulus you set, so you can see exactly how the answer was reached rather than just the final figure. Negative numbers are handled properly too, so entering minus 3 with a modulus of 12 wraps around to 9, rather than returning an ordinary negative remainder. Try the defaults of 15 and 12 to see 15 mod 12 equals 3, because 15 is one full turn of the clock plus 3 left over. Modular arithmetic like this sits behind clocks and calendars, check digits on ISBNs and bank cards, hashing algorithms and cryptography, so it is useful for students checking homework, programmers debugging code, and anyone wanting a fast, reliable answer without working through the division by hand. Change either the number or the modulus and the result updates straight away.

Advertisement
15 mod 12 = 3
Full cycles1
Modulus12

The formula

n mod m is the remainder when n is divided by m, taken as the least non-negative value from 0 to m minus 1. Negative numbers wrap around: the calculator returns ((n mod m) + m) mod m.

Worked example

15 mod 12 = 3, because 15 is one full turn of 12 plus 3. And minus 3 mod 12 = 9, wrapping back round the clock. Enter 15 and 12 to confirm.

Frequently asked questions

What is modular arithmetic?

Arithmetic that wraps around after reaching a modulus m, like hours on a clock. The result is the remainder from 0 to m minus 1.

How are negatives handled?

They wrap to a positive residue, so minus 1 mod 12 is 11.

Where is it used?

Clocks and calendars, ISBN and card check digits, hashing, and cryptography.

Who this calculator is for

This calculator is for students, programmers and anyone needing a quick, reliable result.

What this calculator assumes

  • You enter valid input.
  • The standard algorithm is applied.
  • Results are rounded for display.

Formula and sources

Related calculators

If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.

Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.

Calculate.co.nz is the sister site of CalculatorHub.com, the world's largest calculator website by tool count.

All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.

Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.

Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.

Calculate.co.nz is hosted in Auckland by SiteHost New Zealand.

All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.

About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use

Reviewed and maintained. Last reviewed 2026-08-15 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.

© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.