Kaprekar Routine Calculator
- Kaprekar's routine: rearrange the digits of a 4-digit number into the largest and smallest orders and subtract. Repeat, and every non-degenerate start arrives at the same constant.
- Starting from 3,524: the largest arrangement is 5,432 and the smallest is 2,345, giving 3,087 on the first subtraction.
- The differences then funnel inwards - large spreads shrink, small spreads grow - and after 3 subtractions the routine lands on 6,174.
- Once at 6,174 the routine is stuck there by design: 7,641 - 1,467 = 6,174. No 4-digit start needs more than 7 subtractions.
The Kaprekar routine calculator takes a four-digit number and shows you the path to 6174, the number this process always reaches. Each step sorts the digits into the largest and smallest arrangements, subtracts the smaller from the larger, and repeats with the result. Starting from 3524, the routine reaches 6174 in 3 subtractions; the first subtraction alone gives 3,087. Starting from 1000 takes 5 subtractions, because the zeros make the smallest arrangement just 1, so the differences shrink slowly. For three-digit numbers the constant is 495: 594 lands on it in a single subtraction (954 - 459). The calculator does the sorting and subtracting for you and lays out every intermediate result, so you can follow the whole sequence rather than just seeing the final constant.
The method behind this page is the standard definition of the Kaprekar routine: sort the digits descending and ascending, subtract, and repeat. That is why the results are the accepted ones for this calculation. No 4-digit start needs more than 7 subtractions to reach 6174, and every start with at least two different digits gets there, so the calculator can report a definite step count for any valid input. This page shows the formula, step-by-step workings, worked examples and sources, so you can check each subtraction yourself and see exactly how the count is produced.
Worked examples
4-digit start 3524
(3524 · 4 digits (constant 6174))
| Subtractions to reach the constant | 3 |
| Kaprekar constant | 6,174 |
| First subtraction result | 3,087 |
| Largest arrangement of the start | 5,432 |
| Smallest arrangement of the start | 2,345 |
4-digit start 1000, mostly zeros
(1000 · 4 digits (constant 6174))
| Subtractions to reach the constant | 5 |
| Kaprekar constant | 6,174 |
| First subtraction result | 999 |
| Largest arrangement of the start | 1,000 |
| Smallest arrangement of the start | 1 |
3-digit start 594
(594 · 3 digits (constant 495))
| Subtractions to reach the constant | 1 |
| Kaprekar constant | 495 |
| First subtraction result | 495 |
| Largest arrangement of the start | 954 |
| Smallest arrangement of the start | 459 |
How the Kaprekar routine works
The Kaprekar routine is a fixed procedure you repeat on a number's digits. Take a four-digit number, arrange its digits from largest to smallest to form one number, then arrange the same digits from smallest to largest to form another. Subtract the smaller from the larger. Whatever result you get becomes the input for the next round, and you keep going until the number stops changing. A Kaprekar routine calculator simply performs these rounds for you, so you can watch each subtraction and see how quickly the digits settle into the constant 6174.
A concrete example shows the pattern. Start with 3524. Sorting the digits descending gives 5432, and sorting them ascending gives 2345. The first subtraction is 5432 - 2345 = 3,087. That single step already moves the number toward the target, and from 3524 the routine reaches 6174 in 3 subtractions total. Each round repeats the same sort-and-subtract move on the previous result, so the process is fully mechanical — no choices are involved once you pick a starting number.
The number of rounds depends on the starting digits. Starting from 1000 takes 5 subtractions, because the zeros make the smallest arrangement just 1. With such a small number to subtract, the differences shrink slowly at first, and the routine needs more rounds before it locks onto 6174. This is why some starts feel fast and others feel sluggish even though the rule is identical every time.
The same idea works with three digits, where the constant is 495. For instance, 594 lands on it in a single subtraction: 954 - 459 = 495. The routine's behavior across all four-digit starts is remarkably consistent. No 4-digit start needs more than 7 subtractions to reach 6174, and every start with at least two different digits gets there. The one exception is a number whose digits are all identical, such as 1111 or 2222: sorting and subtracting gives zero, and the routine goes no further. As long as at least two digits differ, the process is guaranteed to arrive at the constant.
To use the routine yourself, follow the same three moves on every round: sort the digits descending, sort them ascending, and subtract. Then feed the difference back in. Watching the intermediate values is the clearest way to understand why the routine converges, and it makes the round counts above easy to verify by hand.
The two constants: 495 and 6174
The Kaprekar routine settles on one fixed point for each digit length: 495 for three-digit numbers and 6174 for four-digit numbers. A fixed point means the number reproduces itself — arrange its digits largest-to-smallest, arrange them smallest-to-largest, subtract, and you get the same number back. That is why these two values are called constants rather than just common destinations. A kaprekar routine calculator simply automates the sort-subtract-repeat cycle, but the constants are what make the cycle worth watching.
The three-digit constant is 495. The clearest demonstration is 594: sort its digits descending to get 954, ascending to get 459, and subtract. 954 - 459 = 495, so 594 lands on the constant in a single subtraction. Once at 495, the loop closes: 954 - 459 = 495 again, and again, for as long as you keep going. Three-digit starts generally funnel toward this value, and 594 shows how short the trip can be.
For four-digit numbers the destination is 6174. Starting from 3524, the routine reaches it in 3 subtractions, and the very first subtraction alone gives 3,087 — a reminder that intermediate differences can look nothing like the final constant. Starting from 1000 takes 5 subtractions, because the zeros make the smallest arrangement just 1, so the differences shrink slowly before the digits line up to produce 6174. As with 495, the constant reproduces itself: once you arrive, the next subtraction returns 6174.
The four-digit case is remarkably dependable. No 4-digit start needs more than 7 subtractions to reach 6174, and every start with at least two different digits gets there. That upper bound of 7 is small enough that you can trace any four-digit number by hand in a few lines, though a kaprekar routine calculator saves the sorting and subtraction at each step. The two constants also make a useful check on your work: if a three-digit run ends anywhere other than 495, or a four-digit run with at least two different digits stalls without reaching 6174, something in the arithmetic went wrong.
- 3 digits: the constant is 495; 594 arrives in one subtraction (954 - 459 = 495).
- 4 digits: the constant is 6174; 3524 arrives in 3 subtractions, and 1000 takes 5.
- Both constants reproduce themselves: applying the routine to 495 or 6174 returns the same number.
- No 4-digit start needs more than 7 subtractions to reach 6174, and every start with at least two different digits gets there.
Why some starts take longer
Not every starting number reaches 6174 at the same speed. The Kaprekar routine always gets there, but the number of subtractions needed depends on what you feed it. A start like 3524 moves quickly: the first subtraction alone gives 3,087, and the routine reaches 6174 in 3 subtractions total. Compare that with 1000, which takes 5 subtractions. Same rule, same constant, different pace — and the reason comes down to zeros.
Zeros are the slow ingredient. With 1000, sorting the digits descending gives 1000 and ascending gives 0001, so the smallest arrangement is just 1. The first difference is 999 — a small number that has to grow before it can settle into the funnel that leads to 6174. Starts rich in zeros begin with small differences, and those differences shrink slowly, so more rounds pass before the digits reorganize into the familiar pattern. If you want to see the round count for a particular start, a kaprekar routine calculator can run the subtractions for you and show each step.
The pace varies, but the destination does not. No 4-digit start needs more than 7 subtractions to reach 6174, and every start with at least two different digits gets there. That upper bound of 7 matters for how you read a slow result: a start that takes 5 or 6 rounds is not stuck or broken. It is simply a start whose early differences are small, and the routine is doing exactly what it should.
The same idea shows up in the 3-digit version of the routine, where the constant is 495. Take 594: sorting gives 954 and 459, and one subtraction (954 - 459) lands directly on 495. That is the fast case — an arrangement whose digits are already close to the constant's shape. Starts with zeros work the other way, producing small differences that need extra rounds to build up. Whether you are working with 4 digits and 6174 or 3 digits and 495, the count of subtractions is a measure of how far the starting arrangement sits from the constant, not of whether the routine will succeed.
- 3524: 3 subtractions to 6174; the first subtraction gives 3,087.
- 1000: 5 subtractions; the smallest arrangement is 1, so the differences shrink slowly.
- 594 (3-digit routine): 1 subtraction to 495 (954 - 459).
- 4-digit maximum: no start needs more than 7 subtractions, and every start with at least two different digits reaches 6174.
Reading your result
When you run a number through the Kaprekar routine calculator, the list of subtractions it returns tells a story. Each line is one round of the process: arrange the digits largest to smallest, arrange them smallest to largest, and subtract. Reading down the list, you see the differences close in on the target. Starting from 3524, the routine reaches 6174 in 3 subtractions, and the first subtraction alone gives 3,087. The remaining steps tighten that gap until the constant appears.
How fast the differences shrink depends heavily on the digits you start with, especially the zeros. Starting from 1000 takes 5 subtractions, because the zeros make the smallest arrangement just 1, so the differences shrink slowly. A start with zeros scattered through it tends to produce small lower numbers and therefore smaller first differences, which stretches the run out. Compare that with a start like 3524, where the first subtraction already lands at 3,087 and the path to 6174 is short.
The reassuring part of reading your result is that the ending is never in doubt. No 4-digit start needs more than 7 subtractions to reach 6174, and every start with at least two different digits gets there. So if your list is long, it is still bounded: count the lines and you will see it finish within that ceiling. The number of subtractions is a measure of how awkward the starting digits are, not of whether the routine will succeed.
The same logic applies if you are working with three digits. The 3-digit constant is 495, and 594 lands on it in a single subtraction (954 - 459). A short list here simply means the digits were already well suited to the routine, just as a long list means the small arrangements kept the differences modest for a few rounds.
There is one exception to watch for, and it is the one result that looks like a failure but is not. A start whose digits are all equal collapses to 0 instead of reaching the constant. With identical digits, the largest and smallest arrangements are the same number, so the subtraction yields zero on the first round and stays there. When you see a single 0 in your output, check the starting digits: they were all the same, which is the case the routine cannot lift out of. Any other start with at least two different digits will show the differences homing in until the constant appears.
FAQs
What is Kaprekar's constant?
Kaprekar's constant is 6174 for four-digit numbers and 495 for three-digit numbers. In the Kaprekar routine, you arrange a number's digits from largest to smallest and from smallest to largest, subtract the smaller from the larger, and repeat. Every valid start reaches one of these two constants.
How many steps does 3524 take?
Starting from 3524, the routine takes 3 subtractions. The first subtraction gives 3,087, and the routine lands on 6,174 two steps later. So 3524 reaches Kaprekar's constant in three steps total.
What is the maximum number of steps?
The maximum is 7 subtractions for any four-digit start, and 6 for three-digit starts. No valid starting number needs more than that to reach its constant, whether that constant is 6174 for four digits or 495 for three digits.
Why does 1111 not reach 6174?
1111 has all its digits equal, so the largest arrangement minus the smallest arrangement is 0 in one step. That is the degenerate case: the routine collapses to zero instead of converging on 6174. Numbers with all digits the same never reach the constant.
How fast does 1000 converge?
1000 converges in 5 subtractions. Its smallest arrangement is 1, so the first difference is only 999. From there the routine continues, and after five subtractions total it reaches 6174.
Does 6174 really map to itself?
Yes. Arranging the digits of 6174 from largest to smallest gives 7641, and from smallest to largest gives 1467. Subtracting gives 7641 - 1467 = 6174, which is why the routine stops there: the number maps to itself.