Skip to main content

Happy Number Calculator

API reference

Check whether a number is a happy number. See each step of the sum-of-squared-digits process, the cycle that unhappy numbers fall into, and the next happy numbers after yours.

Input

Output

Step-by-step
 
Was this helpful?

More ways to use this tool

REST API

curl -X POST https://api.iotools.cloud/v1/tool/happy-number-calculator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "number": "19"
  }'

Swap in your own key from your account. The tool's fields are the body — no wrapper.

Ask an AI agent

Use the IOTools `happy-number-calculator` tool (Happy Number Calculator) on this input:

YOUR_INPUT_HERE

Paste this at any agent connected to the IOTools MCP server, then add your input.

Embed widget

<iframe
  src="https://iotools.cloud/embed/happy-number-calculator/"
  width="100%" height="520" frameborder="0" scrolling="no" loading="lazy"
  title="Happy Number Calculator — iotools.cloud"
  sandbox="allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox"
  allow="clipboard-write"
  style="width:100%;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden"></iframe>
<script src="https://iotools.cloud/embed.js" async></script>

Drop this into your own page — free, no key required, just a link back.

Cost per API/MCP callFrom 5 credits
Need more credits?View pricing

Also available with

Guides

The Happy Number Calculator tells you whether a number is happy and shows every step of the process, so you can follow the arithmetic yourself.

What is a happy number?

Take any positive integer and replace it with the sum of the squares of its digits. Repeat. If you eventually reach 1, the number is happy. Otherwise it loops forever — every unhappy number ends in the cycle 4 → 16 → 37 → 58 → 89 → 145 → 42 → 20 → 4.

For example, 19 → 1² + 9² = 82 → 8² + 2² = 68 → 6² + 8² = 100 → 1 + 0 + 0 = 1, so 19 is happy. The first happy numbers are 1, 7, 10, 13, 19, 23, 28, 31, 32, 44, 49, 68, 70, 79, 82, 86, 91, 94, 97 and 100.

How to use it

  1. Enter a positive whole number (commas and spaces are ignored).
  2. Read the verdict, the full sequence, and the step-by-step digit-squares breakdown.
  3. The tool also lists the next 10 happy numbers after yours.

Is there a limit on size?

Up to 100 digits; the "next happy numbers" list is shown for numbers below one trillion.

Want to check other number properties?

Use the Prime Checker to test primality, or the Twin Prime Finder to list twin primes.

Privacy

Everything runs locally in your browser. Nothing you enter is uploaded.

happy numbernumber theorysum of squaresdigitsmathrecreational math

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.