Formatting Utilities

Format Percentage

Converts decimal numbers to properly formatted percentages with customizable precision. Use via MCP in Cursor or Windsurf, or call GET /v1/format/percentage directly. Input 0.1234 returns "12.34%" — handles edge cases like negatives and zero reliably. Essential for financial dashboards and data visualization where consistent percentage display matters.

API Endpoint

GET /v1/format/percentage

Code Examples

curl "https://tinyfn.io/v1/format/percentage" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/format/percentage', {
  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/percentage',
    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 a decimal as a percentage with specific decimal places?

Pass the decimal value and specify precision parameter. For example, 0.1234 with 2 decimal places returns "12.34%".

Does the percentage formatter handle negative numbers correctly?

Yes, negative decimals format properly as negative percentages. -0.05 becomes "-5.00%" maintaining the sign.

Can MCP agents use this for financial data formatting in spreadsheets?

Absolutely. AI agents in Cursor or Cline can format rate data, conversion metrics, or financial ratios consistently across datasets.

What happens when I format zero or very small numbers as percentages?

Zero formats as "0.00%" and very small decimals round according to specified precision without throwing errors.

Is this better than using JavaScript's toFixed() for percentage display?

Yes, it handles the multiplication by 100 and adds the % symbol automatically, plus provides consistent formatting across different locales.

Try Format Percentage Now

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

Get Free API Key