---
source: https://carbone.io/documentation/design/formatters/number.html
title: "Carbone Number Formatting"
description: "List of functions to manipulate and transform your JSON numbers"
generated_at: "2026-07-13"
---

# Number Formatting

List of functions to manipulate and transform your JSON numbers  
COMMUNITY FEATURE Available for:  
✓ Carbone Cloud  
✓ Carbone On-premise  
✓ Embedded Carbone JS   v2.0+ 

## :formatN(precision)

v1.2.0+

Format number according to the locale.  
Applying a number of decimals depends on the report type:

-   For ODS/XLSX, the number of decimals has to be formatted based on the text editor.
-   For the other types of files, the number of decimals depends on the `precision` parameter passed to the formatter.

| Params | Description | Type |
| --- | --- | --- |
| precision | Number of decimals | Number |

_Examples_

```javascript
// With API options: {
//   "lang": "en-us"
// }
{d.value:formatN()} // input: "10" → output: "10.000"
{d.value:formatN()} // input: "1000.456" → output: "1,000.456"
```

## :round(precision)

v1.2.0+

Round a number

Same as toFixed(2) but it rounds number correclty `round(1.05, 1) = 1.1`

| Params | Description | Type |
| --- | --- | --- |
| precision | number of decimal | Number |

_Examples_

```javascript
{d.value:round(2)} // input: 10.05123 → output: 10.05
{d.value:round(1)} // input: 1.05 → output: 1.1
```

## :add(value)

v1.2.0+

Add two numbers

| Params | Description | Type |
| --- | --- | --- |
| value | Value to add | Number |

_Examples_

```javascript
{d.value:add(2)} // input: 1000.4 → output: 1002.4
{d.value:add('2')} // input: "1000.4" → output: 1002.4
```

## :sub(value)

v1.2.0+

Subtract two numbers

| Params | Description | Type |
| --- | --- | --- |
| value | Value to subtract | Number |

_Examples_

```javascript
{d.value:sub(2)} // input: 1000.4 → output: 998.4
{d.value:sub('2')} // input: "1000.4" → output: 998.4
```

## :mul(value)

v1.2.0+

Multiply two numbers

| Params | Description | Type |
| --- | --- | --- |
| value | Value to multiply | Number |

_Examples_

```javascript
{d.value:mul(2)} // input: 1000.4 → output: 2000.8
{d.value:mul('2')} // input: "1000.4" → output: 2000.8
```

## :div(value)

v1.2.0+

Divide two numbers

| Params | Description | Type |
| --- | --- | --- |
| value | Value to divide | Number |

_Examples_

```javascript
{d.value:div(2)} // input: 1000.4 → output: 500.2
{d.value:div('2')} // input: "1000.4" → output: 500.2
```

## :mod(value)

NEW v4.5.2+

Compute modulo

| Params | Description | Type |
| --- | --- | --- |
| value | Y | Number |

_Examples_

```javascript
{d.value:mod(2)} // input: 4 → output: 0
{d.value:mod(2)} // input: 3 → output: 1
```

## :abs

NEW v4.12.0+

Get absolute value

_Examples_

```javascript
{d.value:abs()} // input: -10 → output: 10
{d.value:abs()} // input: -10.54 → output: 10.54
{d.value:abs()} // input: 10.54 → output: 10.54
{d.value:abs()} // input: "-200" → output: 200
```

## :ceil

v4.22.8+

Rounds towards closest higher integer number

_Examples_

```javascript
{d.value:ceil()} // input: 10.05123 → output: 11
{d.value:ceil()} // input: 1.05 → output: 2
{d.value:ceil()} // input: -1.05 → output: -1
```

## :floor

v4.22.8+

Rounds towards closest lower integer number.

_Examples_

```javascript
{d.value:floor()} // input: 10.05123 → output: 10
{d.value:floor()} // input: 1.05 → output: 1
{d.value:floor()} // input: -1.05 → output: -2
```

## :int

UNRECOMMENDED FOR USE v1.0.0+

Converts a number to an INT

## :toEN

UNRECOMMENDED FOR USE v1.0.0+

Converts a number with English specifications (decimal separator is '.')

## :toFixed

UNRECOMMENDED FOR USE v1.0.0+

Converts a number into string, keeping only decimals

## :toFR

UNRECOMMENDED FOR USE v1.0.0+

Converts a number with French specifications (decimal separator is ',')

Get inspired by one of our real-life examples: [Planning with subtotals](/examples/planification-medium/index.md), [Gallery of images](/examples/gallery-simple/index.md), [Grid Layout](/examples/matrix-pptx/index.md) or [Bank Statement](/examples/bank-statement-simple/index.md)

## Related topics

- [Text Formatting](/documentation/design/formatters/text.md)
- [How formatters work](/documentation/design/formatters/overview.md)
- [Interval and Duration](/documentation/design/formatters/interval.md)
- [Date Formatting](/documentation/design/formatters/date.md)
- [Currency Formatting](/documentation/design/formatters/currency.md)
- [Array manipulation](/documentation/design/formatters/array.md)
