{"uid":"cap_srCzaJyZj9IVuuuq7z7pm","slug":"locale-and-formatting-tools-format-number-7cc1b8ab","name":"Locale and Formatting Tools – Format Number","description":"Format a number as decimal, percent, compact (1.2K) or unit text in any BCP47 locale, with digit control.","url":"https://locale-tools.x402tookit.com/format-number?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["value"],"properties":{"unit":{"type":"string","description":"For style=unit: an ECMA-402 sanctioned unit such as kilometer, celsius, kilometer-per-hour (up to 40 characters)"},"style":{"type":"string","description":"decimal (default), percent (value 0.25 gives 25%), compact, or unit"},"value":{"type":"number","description":"Number to format, absolute value up to 1e18"},"locale":{"type":"string","description":"BCP47 tag such as de-DE, ar-EG or en-IN (default en-US, up to 60 characters)"},"unitDisplay":{"type":"string","description":"short (default), long or narrow"},"compactDisplay":{"type":"string","description":"For style=compact: short (1.2K, default) or long (1.2 thousand)"},"maxFractionDigits":{"type":"integer","description":"Maximum fraction digits, 0 to 20"},"minFractionDigits":{"type":"integer","description":"Minimum fraction digits, 0 to 20"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"parts":{"type":["array","null"],"items":{"type":"object","properties":{"type":{"type":["null","string"]},"value":{"type":["null","string"]}}}},"style":{"type":["null","string"]},"locale":{"type":["null","string"]},"source":{"type":["null","string"]},"reasons":{"type":["array","null"]},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"formatted":{"type":["null","string"]},"disclaimer":{"type":["null","string"]},"icuVersion":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"cldrVersion":{"type":["null","string"]},"resolvedLocale":{"type":["null","string"]},"unicodeVersion":{"type":["null","string"]},"numberingSystem":{"type":["null","string"]}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_DmJtOHR8q7wAHG13B914e","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Format a number as decimal, percent, compact (1.2K), or unit text in any BCP47 locale with configurable fraction digit control.","exampleAgentPrompt":"Format the number 1234567.89 as compact style (like '1.2M') in the German locale de-DE, with a maximum of 2 fraction digits.","exampleUseCases":[{"title":"Dashboard number localization for international users","prompt":"I need to display the value 98765 as a compact number (like '98.8K') in Japanese locale ja-JP with no fraction digits — what does that look like?"},{"title":"Percentage display for analytics report","prompt":"Format 0.0342 as a percentage in French locale fr-FR, showing exactly 2 decimal places, so it renders something like '3,42 %'."},{"title":"Unit formatting for a metric measurement app","prompt":"Show the number 120.5 formatted as kilometers per hour in Italian locale it-IT using unit style with short display — what's the localized string?"}],"resultDescription":"Returns a JSON object containing the formatted string (e.g. '1,2 Mio.'), the resolved locale, the style applied, an array of format parts (type + value tokens), CLDR and ICU version metadata, and an optional disclaimer or degraded flag if locale support is partial.","failureModes":["Unsupported or malformed BCP47 locale tag returns an error or falls back to en-US with a warning","Value exceeding 1e18 absolute is rejected","Invalid style enum value (not decimal/percent/compact/unit) causes a validation error","Unit style without a valid ECMA-402 unit string returns an error","minFractionDigits > maxFractionDigits causes a conflict error","Missing required 'value' query parameter returns a 400-level error"],"whenToPreferThis":"Choose this endpoint when you need locale-aware number formatting beyond simple toString() — particularly for multi-locale dashboards, internationalized reports, or user-facing UIs where separators, compact notation, percent signs, and unit labels must follow regional conventions. Prefer it over hardcoded formatting when targeting non-English locales (Arabic, German, Hindi, Japanese) or when you need fraction digit control and CLDR-compliant output parts for custom rendering.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-02T12:31:02.328Z","isFirstParty":false,"canonicalSlug":"locale-and-formatting-tools-format-number-7cc1b8ab"}