---
title: "unhex function in Strata | Oplema"
description: "Convert a hexadecimal string into a BLOB value holding the original bytes. Write it as unhex(value) in a Strata Formula or Filter."
url: "https://oplema.com/docs/strata/functions/unhex"
updated: "2026-11-04"
---

# unhex

Converts a value from hexadecimal representation to a blob.

Also available as from\_hex.

## Try an expression

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

### Expression

```
unhex('2A')
```

### Result

```
'*'
```

The expression returns `BLOB`. Formula stores it as `VARCHAR` in this example. 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 | \* |

## Arguments and types

```
unhex(value)
```

**value**

Text

Supported signatures (1)

```
unhex(value: VARCHAR) → BLOB
```

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

[unbin

Converts a value from binary representation to a blob.

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

Convert a value to hexadecimal text.

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

Converts the string to binary representation.

](https://oplema.com/docs/strata/functions/bin)[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)

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

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