---
title: ES|QL TO_BASE64 function
description: 
url: https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/string-functions/to_base64
products:
  - Elasticsearch
---

# ES|QL TO_BASE64 function
## Syntax

![Embedded](https://www.elastic.co/docs/reference/query-languages/esql/images/generated/x-pack-esql/functions/to_base64.svg)


## Parameters

<definitions>
  <definition term="string">
    A string.
  </definition>
</definitions>


## Description

Encode a string to a base64 string.

## Supported types


| string  | result  |
|---------|---------|
| keyword | keyword |
| text    | keyword |


## Example

```esql
ROW a = "elastic"
| EVAL e = TO_BASE64(a)
```


| a:keyword | e:keyword    |
|-----------|--------------|
| elastic   | ZWxhc3RpYw== |