---
url: >-
  /statelake/scripting-reference/functions-and-procedures/conversion-functions/bintohex.md
---

# BinToHex

**BinToHex** converts a **String** representing a binary value. into a **String** representing a hexadecimal value.

This is used when you need to read into **Binary** type fields within a database or file.

Declaration: Function BinToHex( Value : Variant) : string

An example follows.

```pascal
procedure OnMapEvent(var Value:Variant);
begin
  Value := BinToHex(BinaryField.Value);
end;
```
