---
title: "hex function in Strata | Oplema"
description: "Convert text or binary data to its hexadecimal representation, such as 48656C6C6F for Hello. Write it as hex(string) in a Strata Formula or Filter."
url: "https://oplema.com/docs/strata/functions/hex"
updated: "2026-11-04"
---

# hex

Convert a value to hexadecimal text.

Also available as to\_hex.

## Try an expression

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

### Expression

```
hex('Hello')
```

### Result

```
'48656C6C6F'
```

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 | 48656C6C6F |

## Arguments and types

```
hex(string)
```

**string**

Text

**value**

Number

**blob**

Binary data

Supported signatures (7)

```
hex(blob: BLOB) → VARCHAR
hex(string: VARCHAR) → VARCHAR
hex(value: BIGINT) → VARCHAR
hex(value: BIGNUM) → VARCHAR
hex(value: HUGEINT) → VARCHAR
hex(value: UBIGINT) → VARCHAR
hex(value: UHUGEINT) → 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

[bin

Converts the string to binary representation.

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

Converts a value from hexadecimal representation to a blob.

](https://oplema.com/docs/strata/functions/unhex)[format\_bytes

Convert a byte count to a readable size using units based on powers of 2, such as KiB, MiB and GiB. Also available as pg\_size\_pretty.

](https://oplema.com/docs/strata/functions/format-bytes)[from\_base64

Decode base64 text into binary data.

](https://oplema.com/docs/strata/functions/from-base64)

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

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