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.
Using the Palindrome Checker API
TinyFn provides a comprehensive endpoint for palindrome checking:
GET https://api.tinyfn.io/v1/math/palindrome?number=12321
Headers: X-API-Key: your-api-key
{
"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
- Handle negative numbers: Decide if -121 should be considered a palindrome
- Consider leading zeros: Numbers don't have leading zeros, but strings do
- Use nearest palindrome: Useful for finding palindromic replacements
- Explore other bases: Numbers can be palindromes in different bases
- 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