---
source: https://carbone.io/documentation/design/substitutions/aliases.html
title: "Simplify Carbone tag with aliases"
description: "Simplify Carbone tag with aliases"
generated_at: "2026-07-13"
---

# Aliases

Simplify Carbone tag with aliases  
COMMUNITY FEATURE Available for:  
✓ Carbone Cloud  
✓ Carbone On-premise  
✓ Embedded Carbone JS   v2.0+ 

## Alias

Aliases can be used to simplify the maintenance of your report by avoiding repetition of code, or to insert tags where special characters such as square brackets are not allowed (for example, worksheet names).

-   Write `{#... = ...}` to define an alias
-   Write `{$...}` to use this alias

Aliases can be defined anywhere in the document, at the end, or at the beginning. They are parsed and removed by Carbone before rendering.

```cdata
{
  "name": "Cars",
  "wheels": 4
}
```

```ctemplate
{#myAlias = d.wheels}
{d.name} need {$myAlias} wheels!
```

```cresult
Cars need 4 wheels!
```

> ⚠️ **Warning:** Aliases do not store values. They are simply shortcuts. [More information](#more-information)

Get inspired by one of our real-life examples: [Prescription](/examples/prescription/index.md), [Stock Inventory Spreadsheet](/examples/stock-inventory-spreadsheet/index.md) or [Planning with subtotals](/examples/planification-medium/index.md)

## Parametrized Alias

Aliases accept an unlimited number of parameters between parentheses, like a function in many languages. Each parameter must start by `$`.

```cdata
[
  { "name": "chicken", "weekday": 1 },
  { "name": "fish"   , "weekday": 2 }
]
```

```ctemplate
{#mealOf($weekday) = d[weekday = $weekday]}
Tuesday, we eat {$mealOf(2).name}.
```

```cresult
Tuesday, we eat fish.
```

## More information

An alias cannot store a value. It is just a shortcut.

If you need to store a value, use the [:set formatter](/documentation/design/computation/store-and-transform.md):

```text
{d.products[].price:aggSum:set(c.total)}
{c.value}
```

Aliases are replaced by Carbone with the actual tag before processing the template. They act as a preprocessor tool (similar to `#define` in C language).

For example:

| Alias | Template | What Carbone Sees | Result |
| --- | --- | --- | --- |
| `d.obj` | `{d.val:mul($alias.qty)}` | `{d.val:mul(d.obj.qty)}` | OK |
| `d.arr[i].obj` | `{d.val:mul($alias.qty)}` | `{d.val:mul(d.arr[i].obj.qty)}` | Not supported |

The second case is not supported because Carbone does not support starting a loop with `d.arr[i].obj` inside a formatter.

## Related topics

- [The basics](/documentation/design/substitutions/the-basics.md)
- [Array search](/documentation/design/substitutions/array-search.md)
