# UNHEX()

## Function description

The `UNHEX()` function is used to convert a hexadecimal string to the corresponding binary string. For the `NULL` parameter, this function returns `NULL`.

## Function Syntax

```text
> UNHEX(str)
```

## Parameter definition

| Parameters | Description |
| ---- | ---- |
| str | Required parameters. Must be a legal hexadecimal value. |

## Example

```text
mysql> SELECT UNHEX('4d6174726978204f726967696e');
+------------------------------------------+
| unhex(4d6174726978204f726967696e) |
+------------------------------------------+
| Matrix Origin |
+------------------------------------------+
1 row in set (0.00 sec)

mysql> select unhex(NULL);
+-----------------+
| unhex(null) |
+-----------------+
| NULL |
+-----------------+
1 row in set (0.00 sec)
```
