# HEX()

## Function Description

For string parameter str, `HEX()` returns the hexadecimal string form of str. Where, each byte of each character in str is converted to two hexadecimal numbers (multi-byte characters are converted to more than two numbers).

For the numeric parameter N, `HEX()` returns the hexadecimal string form of the N value and is converted as an integer. This is equivalent to `CONV(N,10,16)`, and the opposite operation performs `CONV(HEX(N),16,10)`.

For the `NULL` parameter, this function returns `NULL`.

## Function Syntax

```text
> HEX(str), HEX(N)
```

## Parameter definition

| Parameters | Description |
| ---- | ---- |
| N | Required parameters. To convert to hexadecimal number. |
| str | Required parameters. A string, whose character is converted to two hexadecimal numbers. |

## Example

```text
> SELECT HEX('abc');
+----------+
| hex(abc) |
+----------+
| 616263   |
+----------+
1 row in set (0.00 sec)

> SELECT HEX(255);
+----------+
| hex(255) |
+----------+
| FF       |
+----------+
1 row in set (0.00 sec)
```
