Snipget.ai

Numbers format

Exact
numbers_format

Deterministic and authoritative — the canonical answer for this input.

Format a number with grouped thousands and a fixed number of decimal places. Separators are configurable (e.g. '.'/',' for European style). Processing multiple inputs? Use `numbers_format_batch` to do up to 1000 in one call.

Parameters

valuestringrequired

The number to format.

decimal_placesintegeroptional

Fixed number of decimal places.

thousands_separatorstringoptional

Thousands grouping separator.

decimal_separatorstringoptional

Decimal point separator.

Call it

curl -X POST https://api.snipget.ai/v1/numbers/format \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"value":"1234567.5","decimal_places":2}'

The Batch tab sends up to 1000 inputs in one call via /v1/numbers/format/batch.

Example response

{
  "input": "1234567.5",
  "is_valid": true,
  "formatted": "1,234,567.50"
}

FAQ

Why not just format the number myself?

Grouping thousands, padding decimals, and handling negatives consistently across a whole column is fiddly to get right by hand. This gives every value the same treatment: '1234567.5' with 2 decimal places always comes back as '1,234,567.50'.

Can I get European style, like 1.234.567,50?

Yes. Both separators are configurable: set thousands_separator to '.' and decimal_separator to ',' for the common European style, or a space and a comma, or anything else your output needs.

Does it round or cut off extra decimals?

It rounds to the decimal_places you ask for. Ties round to the nearest even digit (so 0.125 at 2 places becomes 0.12), which is the standard behavior for financial-style formatting. If you omit decimal_places, the value keeps its own precision.

What happens if the input is not a number?

You get a result with confidence 0 and a reason explaining why it could not be formatted, never an error. That makes it safe to run over a messy column and filter on validity afterwards.

What is the difference between this and currency formatting?

This tool formats plain numbers and knows nothing about money. If the value is an amount in a specific currency and you want the right symbol and decimal conventions, use money_currency_format instead.

Related tools