---
title: "to_base64 function in Strata | Oplema"
description: "Encode a binary (BLOB) value as base64 text. Use from_base64 to decode it. For example, to_base64('A'::BLOB) returns 'QQ=='."
url: "https://oplema.com/docs/strata/functions/to-base64"
updated: "2026-11-04"
---

# to\_base64

Encode binary data as base64 text.

Also available as base64.

## Try an expression

In [Formula](https://oplema.com/docs/strata/prep/formula), enter the expression and set Output type to **VARCHAR**.

### Expression

```
to_base64('A'::BLOB)
```

### Result

```
'QQ=='
```

To use your own data, replace the example values with column names. Keep format strings and other options as written.

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | QQ== |

## Arguments and types

```
to_base64(blob)
```

**blob**

Binary data

Supported signatures (1)

```
to_base64(blob: BLOB) → VARCHAR
```

The result type can depend on the input types. See DuckDB for the full argument rules.

## Things to know

If the first argument is missing, the result is NULL.

## Related functions

[from\_base64

Decode base64 text into binary data.

](https://oplema.com/docs/strata/functions/from-base64)[to\_base

Converts number to a string in the given base radix, optionally padding with leading zeros to min\_length.

](https://oplema.com/docs/strata/functions/to-base)[bin

Converts the string to binary representation.

](https://oplema.com/docs/strata/functions/bin)[hex

Convert a value to hexadecimal text.

](https://oplema.com/docs/strata/functions/hex)

[Browse text](https://oplema.com/docs/strata/functions#text) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/text.html#to_base64blob)

Function metadata from DuckDB, used under the [MIT license](https://github.com/duckdb/duckdb/blob/v1.5.4/LICENSE).
