Number Utilities

Sum Digits

Sum Digits adds up all individual digits in a number, returning the total as an integer. Access via MCP in Cursor or Windsurf, or call GET /v1/number/sum-digits with your number. For example, 12345 becomes 15 (1+2+3+4+5). Handles negative numbers by ignoring the sign and processing absolute values.

API Endpoint

GET /v1/number/sum-digits

Code Examples

curl "https://tinyfn.io/v1/number/sum-digits" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/number/sum-digits', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/number/sum-digits',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's number tools:

{
  "mcpServers": {
    "tinyfn-number": {
      "url": "https://tinyfn.io/mcp/number",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How does sum digits work with negative numbers?

The function ignores the negative sign and sums digits of the absolute value. So -789 returns 24 (7+8+9).

What's the sum digits result for single digit numbers?

Single digits return themselves unchanged. For example, 7 returns 7, and 0 returns 0.

Can I use sum digits in MCP tools for digital root calculations?

Yes, repeatedly call sum digits until you get a single digit. Many AI agents use this pattern for numerology or checksum validation.

What format does the sum digits API return?

Returns a simple integer representing the sum. No decimal places or additional formatting.

Does sum digits work with decimal numbers?

Only the integer portion is processed. Decimal points and fractional parts are ignored in the digit summation.

Try Sum Digits Now

Get your free API key and start using Sum Digits in seconds.

Get Free API Key