---
title: fn::toBase64
url: /docs/esc/environments/syntax/builtin-functions/fn-to-base64/
---
The `fn::toBase64` built-in function encodes a binary value using Base64. If the input to `fn::toBase64` is a secret, the encoded value is also a secret.

## Declaration

```yaml
fn::toBase64: value-to-encode
```

### Parameters

| Property          | Type   | Description                                                       |
|-------------------|--------|-------------------------------------------------------------------|
| `value-to-encode` | binary | The value to encode.

### Returns

The encoded data.

## Example

### Definition

```yaml
values:
  binary-data:
    fn::toBase64: hello, world!
```

### Evaluated result

```json
{
  "binary-data": "aGVsbG8sIHdvcmxkIQo="
}
```

