# Number formatter

Format a number with thousands separators, in scientific or compact form, as an ordinal, or in words.

- Endpoint: `POST https://setget.net/v1/tools/number-format` with JSON `{"input": {...}}`
- MCP: `run_tool` with `slug` = `number-format`
- Page: https://setget.net/tools/number-format

## Inputs

- `value` (required, string): The number to format.
- `style` (optional, string, one of `decimal`, `scientific`, `engineering`, `compact`, `ordinal`, `words`, default `"decimal"`): Output style.
- `locale` (optional, string, one of `en`, `de`, `fr`, `ch`, default `"en"`): Separator style for decimal and compact output: en 1,234.5, de 1.234,5, fr 1 234,5, ch 1'234.5.
- `decimals` (optional, integer, range 0..20): Digits after the decimal point. Leave empty to keep the number as written.

## Example 1

```json
{"input":{"value":"1234567.891","decimals":2}}
```

Result:

```json
{"text":"1,234,567.89","style":"decimal","locale":"en"}
```

## Example 2: German separators

```json
{"input":{"value":"1234567.891","locale":"de","decimals":1}}
```

Result:

```json
{"text":"1.234.567,9","style":"decimal","locale":"de"}
```

## Example 3: Compact

```json
{"input":{"value":"1234567","style":"compact"}}
```

Result:

```json
{"text":"1.2M","style":"compact","locale":"en"}
```

## Example 4: Engineering notation

```json
{"input":{"value":"0.000047","style":"engineering"}}
```

Result:

```json
{"text":"47e-6","style":"engineering","locale":"en"}
```

## Example 5: In words

```json
{"input":{"value":"1234","style":"words"}}
```

Result:

```json
{"text":"one thousand two hundred and thirty-four","style":"words","locale":"en"}
```

## Example 6: Ordinal

```json
{"input":{"value":"22","style":"ordinal"}}
```

Result:

```json
{"text":"22nd","style":"ordinal","locale":"en"}
```

**How are halves rounded?** Away from zero, the way most people learn at school: 2.5 becomes 3 and 0.125 with two decimals becomes 0.13.

**What is engineering notation?** Scientific notation where the exponent is always a multiple of 3, so it lines up with prefixes such as kilo, mega and micro.

**Which English is used for words?** British style with "and": one hundred and one. Whole numbers up to one quadrillion (10^15) are supported, and digits after a decimal point are read one by one.
