# UNHEX

Converts a hexadecimal representation to the binary equivalent.

## Syntax

```sql
UNHEX(expression)

```

## Arguments

**expression**

A hexadecimal expression, in upper or lower case.

## Return Type

Binary data.

## Examples

```sql
SELECT HEX('ohai');

```

```output

+-------------+
| HEX('ohai') |
+-------------+
| 6F686169    |
+-------------+

```

```sql
SELECT UNHEX('6F686169');

```

```output

+-------------------+
| UNHEX('6F686169') |
+-------------------+
| ohai              |
+-------------------+
```

## Related Topics

* [HEX](https://docs.singlestore.com/db/v9.1/reference/sql-reference/string-functions/hex.md)

***

Modified at: February 27, 2023

Source: [/db/v9.1/reference/sql-reference/string-functions/unhex/](https://docs.singlestore.com/db/v9.1/reference/sql-reference/string-functions/unhex/)

(An index of the documentation is available at /llms.txt)
