# ToHex

{% hint style="info" %}
The **`ToHex()`** function converts a text or number to its hexadecimal equivalent.

This function is NOT SQL compatible. For more information about SQL compatibility, see our [documentation](https://docs.wem.io/platform/~/changes/y5gAfiyi2fILzrLzUUHj/wemreference/sql-compatibility).
{% endhint %}

{% hint style="success" %}
Returns a hexadecimal value that is the equivalent of the provided text input or (integer) numeric input. For numeric values, decimals will be ignored - only the integer part of the value will be used for conversion.&#x20;
{% endhint %}

### Syntax

<details>

<summary><code>ToHex(</code><mark style="color:blue;"><code>text</code></mark><code>)</code></summary>

`ToHex("`qwertyuiop1234567890`")`\
\&#xNAN;*=>"71776572747975696f7031323334353637383930"*

</details>

<details>

<summary><code>ToHex(</code><mark style="color:blue;"><code>number</code></mark><code>)</code></summary>

`ToHex(255)`\
\&#xNAN;*=>"FF"*

`ToHex(255.2)`\
\&#xNAN;*=>"FF"*

`ToHex(255.7)`\
\&#xNAN;*=>"FF"*

</details>

### Parameters

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="150" align="center">Required</th><th width="248.15953250810662">Description</th><th data-hidden>Required?</th></tr></thead><tbody><tr><td><mark style="color:blue;"><code>text</code></mark></td><td>text</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2611">☑️</span></td><td>Original text to be converted to hexadecimal.</td><td>yes</td></tr><tr><td><mark style="color:blue;"><code>number</code></mark></td><td>numeric</td><td align="center"><span data-gb-custom-inline data-tag="emoji" data-code="2611">☑️</span></td><td>Numeric value to be converted to hexadecimal. Only the integer part of a number will be used, any decimals will be ignored.</td><td></td></tr></tbody></table>
