Modulo Calculator

This calculator computes the modulo operation, the remainder left after dividing one number by another, along with the quotient. Written as a mod n, the modulo is one of the most useful operations in mathematics and programming, yet it is easy to get wrong by hand, especially with negative numbers. It answers the question: after dividing a by n as many whole times as possible, what is left over? Modulo is the engine behind a huge range of everyday computing and maths: telling whether a number is even or odd, wrapping a value around a clock or a calendar, distributing items into groups, generating cycles and patterns, hashing, and checking divisibility. You enter the dividend, a, and the divisor, n, and the calculator returns the remainder and the quotient. It uses the standard mathematical convention where the remainder has the same sign as the divisor, giving a non-negative result for a positive divisor even when a is negative, which is how mathematicians define modulo and how many programming languages behave, though some differ. The results update as you type. Use it to check programming logic, to work out divisibility and cycles, to solve number-theory problems, or simply to find a remainder quickly without long division. A common use is testing for even or odd: a number is even if a mod 2 is zero. Remember the divisor cannot be zero, since dividing by zero is undefined. The calculation is exact for whole-number inputs.

Calculate.co.nz is proud to be partnered with Premium Homes, a recognised leader in eco-friendly, sustainable, and energy-efficient homebuilding. With a dedicated team and award-winning experience, they create homes that prioritise health, comfort, and long-term performance. Their founders, Andrew and Kelly, set out to raise the standard of residential construction in New Zealand by combining practical building expertise with a clear commitment to doing things better for homeowners.
Calculate.co.nz partner
2
remainder (a mod n)
Quotient3
Dividend17
Divisor5

Uses the mathematical convention: the remainder takes the sign of the divisor (non-negative for a positive n). Divisor cannot be zero.

How it works

The quotient is the largest whole number of times the divisor fits into the dividend, rounded toward negative infinity. The remainder is the dividend minus the quotient times the divisor, which leaves a value with the same sign as the divisor. For positive divisors this gives a non-negative remainder between zero and the divisor.

Worked example

For 17 mod 5, the divisor 5 fits into 17 three whole times (3 times 5 is 15), leaving a remainder of 2. So 17 mod 5 equals 2, with a quotient of 3. For a negative dividend like minus 17 mod 5, the convention gives a remainder of 3 and a quotient of minus 4.

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.

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 via 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-06-14 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.