Palindrome Number Checker API: Identify Palindromic Numbers

A palindrome number reads the same forwards and backwards, like 121 or 12321. The Palindrome Number Checker API determines if numbers are palindromes and provides related information about nearby palindromic numbers.

What is a Palindrome Number?

A palindrome number remains the same when its digits are reversed. This includes all single-digit numbers, many two-digit numbers (11, 22, 33...), and increasingly complex patterns as digits increase.

Examples: 7, 11, 121, 1331, 12321, 1234321

Palindrome Patterns

Palindrome numbers follow interesting patterns:

Single Digits

All single digit numbers (0-9) are palindromes by definition.

Two Digits

Only 11, 22, 33, 44, 55, 66, 77, 88, 99 (9 total)

Three Digits

90 palindromes from 101 to 999 (e.g., 101, 111, 121... 989, 999)

Density

Palindromes become relatively rarer as numbers grow larger, but there are infinitely many.

Interesting Fact: The number of n-digit palindromes is 9 * 10^((n-1)/2) for odd n, and 9 * 10^(n/2-1) for even n.

Using the Palindrome Checker API

TinyFn provides a comprehensive endpoint for palindrome checking:

API Request
GET https://api.tinyfn.io/v1/math/palindrome?number=12321
Headers: X-API-Key: your-api-key
Response
{
  "number": 12321,
  "is_palindrome": true,
  "reversed": 12321,
  "digit_count": 5,
  "previous_palindrome": 12221,
  "next_palindrome": 12421,
  "digits": [1, 2, 3, 2, 1]
}

Parameters

Parameter Type Description
number integer The number to check (required)
find_nearest boolean Find previous and next palindromes (default: true)
base integer Number base for palindrome check (default: 10)

Code Examples

JavaScript / Node.js

const response = await fetch(
  'https://api.tinyfn.io/v1/math/palindrome?number=12345',
  { headers: { 'X-API-Key': 'your-api-key' } }
);
const data = await response.json();
console.log(`Is palindrome: ${data.is_palindrome}`);
console.log(`Next palindrome: ${data.next_palindrome}`);

Python

import requests

response = requests.get(
    'https://api.tinyfn.io/v1/math/palindrome',
    headers={'X-API-Key': 'your-api-key'},
    params={'number': 1000}
)
data = response.json()
print(f"1000 is palindrome: {data['is_palindrome']}")
print(f"Nearest palindrome: {data['next_palindrome']}")  # 1001

cURL

curl "https://api.tinyfn.io/v1/math/palindrome?number=12321" \
  -H "X-API-Key: your-api-key"

Common Use Cases

  • Programming Challenges: Classic coding interview question
  • Educational Tools: Teach number symmetry concepts
  • Date Validation: Find palindrome dates (e.g., 02/02/2020)
  • ID Generation: Create memorable palindromic identifiers
  • Number Games: Build puzzles around palindrome discovery

Best Practices

  1. Handle negative numbers: Decide if -121 should be considered a palindrome
  2. Consider leading zeros: Numbers don't have leading zeros, but strings do
  3. Use nearest palindrome: Useful for finding palindromic replacements
  4. Explore other bases: Numbers can be palindromes in different bases
  5. Combine with other checks: Find numbers that are both palindromes and primes

Try the Palindrome Number Checker API

Get your free API key and start checking palindrome numbers.

Get Free API Key

Ready to try TinyFn?

Get your free API key and start building in minutes.

Get Free API Key