## Syntax
```mermaid
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> TO_BINARY[TO_BINARY]:::quoted
TO_BINARY --> End((END))
```
## Purpose
The `TO_BINARY` SQL function converts a value into a BLOB. Text is interpreted as UTF-8.
See also [[ASCII_TO_BLOB]], [[UNICODE_TO_BLOB]] and [[HEX_TO_BLOB]].
Parameters:
- Input (`ANY`): value to convert.
Returns: the input converted to a BLOB.
## Examples
The following example converts the text `hi` to a BLOB and retrieves the base64 representation:
```sql
select base64_encode(to_binary('hi'))
-------------------
aGk=
```
The following example converts the text `abc` to a BLOB and retrieves the length in bytes:
```sql
select length(to_binary('abc'))
-------------------
3
```