> For the complete documentation index, see [llms.txt](https://docs.fortifiedid.se/pipes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fortifiedid.se/pipes/valves/codecs/base64-encode.md).

# Base64 Encode

Valve for Base 64 encoding properties

## Introduction

This valve encodes item properties using base 64. The encoded value can replace the source value or replace/create a new named property.

Note that items only support string properties, meaning that this valve will base 64 encode the binary value of a (string) property. A real binary value (like a PDF document or an image) must be base 64 encoded before added to an item.

{% hint style="info" %}
This valve is a part of the item iteration API meaning that it operates on the current item set. For more information on item iteration, see [Item](/pipes/valves/item.md).
{% endhint %}

## Configuration

{% hint style="info" %}
**Valve name:** `Base64Encode`
{% endhint %}

{% hint style="warning" %}
The properties of this valve has changed to better reflect how the valve actually works.

`value` (previously called `src`) must be an expression expanding to the value to encode (or a static value).&#x20;

`name` (previously called `dest`) must be the name of the property to set with the resulting base64 value.
{% endhint %}

{% tabs %}
{% tab title="Properties" %}

<table><thead><tr><th width="138">Name</th><th width="276">Description</th><th width="206">Default value</th><th width="136" data-type="checkbox">Mandatory</th><th width="126" data-type="checkbox">Expanded</th></tr></thead><tbody><tr><td><code>name</code></td><td>Name of target item property to receive the base 64 encoded value.  (compat: <code>dest</code>).</td><td></td><td>true</td><td>false</td></tr><tr><td><code>value</code></td><td>Value to encode.  (compat: <code>src</code>).</td><td></td><td>true</td><td>true</td></tr><tr><td><code>url_safe</code></td><td>Flag turning on URL safe encoding.</td><td><code>false</code></td><td>false</td><td>false</td></tr><tr><td><code>replace</code></td><td>Flag to turn off replace of target property. When turned off, value will be added to already existing properties (creating a multi-valued property).</td><td><code>true</code></td><td>false</td><td>false</td></tr></tbody></table>

{% endtab %}

{% tab title="Example" %}

```json
{
  "name" : "Base64Encode",
  "config" : {
    "name" : "b64",
    "value" : "${item.plain}",
    "url_safe": true
  }
}
```

{% endtab %}
{% endtabs %}
