# 6174 — Kaprekar's Black Hole > An animated demonstration of Kaprekar's routine: pick any four digits, and watch them > fall into 6174 in at most seven steps. Free, no account, runs entirely in the browser. The site is a single page. You compose a four-digit number on a keypad that refuses only four of a kind, and the routine then runs as an animation: the digits sort themselves into the high and low numbers, the subtraction resolves column by column with its borrows, and each result becomes the next number until 6174 appears. A counter records how many falls the site has shown. Below the app, the same page explains the routine in text. ## The routine 1. Write the number with four digits, keeping any leading zeros. 2. Sort the digits from largest to smallest — the **high** number. 3. Sort the same digits from smallest to largest — the **low** number. 4. Subtract low from high, then start again with the result. Worked example, starting from 3524: | Step | High | Low | Difference | | ---- | ---- | ---- | ---------- | | 1 | 5432 | 2345 | 3087 | | 2 | 8730 | 0378 | 8352 | | 3 | 8532 | 2358 | **6174** | ## Key facts about 6174 - 6174 is called **Kaprekar's constant**, after D. R. Kaprekar, an Indian schoolteacher from Devlali who described the routine in 1949. - It is the only four-digit **fixed point** of the routine: 7641 − 1467 = 6174. - Every four-digit number reaches 6174 **except the ten repdigits** (1111, 2222, … 9999), whose high and low numbers are equal, so the first subtraction gives 0000. - That leaves 9990 of the 10 000 four-digit strings, counting leading zeros, and **none of them needs more than seven steps**. The bound is exact and verifiable by exhaustion: only 715 digit multisets exist. - **Repeated digits are fine.** Only four of a kind fails: 1122 reaches 6174 in four steps, 1112 in five, 1111 in none. 4950 of the working numbers contain a repeat. - Among the 9990 numbers that converge, the step counts are: 0 steps → 1 number (6174 itself), 1 → 383, 2 → 576, 3 → 2400, 4 → 1272, 5 → 1518, 6 → 1656, 7 → 2184. Three steps is the most common; more than a fifth take the maximum. - The three-digit analogue is **495**, reached in at most six steps. Two, five and six-digit numbers have no single constant — they fall into cycles instead. Built by imarkahann. ## Pages - [6174 — Kaprekar's Black Hole](https://kaprekar.xyz/): the animated routine, plus a written explanation of how it works, why it always terminates, and how many steps it takes. - [How it works](https://kaprekar.xyz/#how): the four operations, with a worked example. - [Why it always ends at 6174](https://kaprekar.xyz/#why): the fixed point, the repdigit exception, and the distribution of step counts. - [Common questions](https://kaprekar.xyz/#faq): short answers about the constant, its discoverer, and the three-digit version. ## Optional - [6174 on Wikipedia](https://en.wikipedia.org/wiki/6174_(number)): background and history. - [Kaprekar routine on MathWorld](https://mathworld.wolfram.com/KaprekarRoutine.html): the routine generalised to other digit lengths and bases.