Formatting Utilities

Format Number

Format Number converts numeric values into locale-specific strings with proper thousand separators and decimal marks. Use via MCP in Cursor or Windsurf, or call GET /v1/format/number directly. Pass 1234567.89 with locale "en-US" to get "1,234,567.89" — essential for displaying financial data or user-facing numbers correctly across different regions.

API Endpoint

GET /v1/format/number

Code Examples

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

response = requests.get('https://tinyfn.io/v1/format/number',
    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 formatting tools:

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

Learn more about MCP setup →

FAQ

How do I format numbers for different countries using MCP?

Specify the locale parameter like 'de-DE' for German formatting (1.234.567,89) or 'fr-FR' for French (1 234 567,89). The tool handles decimal separators, thousand separators, and grouping automatically.

What number formats and locales are supported?

Supports all standard BCP 47 locale codes (en-US, ja-JP, ar-SA, etc.) and handles integers, floats, and scientific notation. Returns properly formatted strings with locale-appropriate separators.

Can I control decimal places in formatted output?

Yes, use the minimumFractionDigits and maximumFractionDigits parameters to control precision. Set both to 2 for consistent currency formatting like '$1,234.00'.

Does this work with very large numbers or edge cases?

Handles numbers up to JavaScript's MAX_SAFE_INTEGER limit and properly formats negative numbers, zero, and scientific notation according to locale rules.

What's the difference between this and basic string formatting?

This provides true locale-aware formatting with proper cultural conventions, unlike simple string manipulation. Critical for international applications where '1,234.56' vs '1.234,56' matters.

Try Format Number Now

Get your free API key and start using Format Number in seconds.

Get Free API Key