> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# BASE64

> Encodes bytes as MIME Base64 text.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

**Aliases:** [`to_base64`](/query/sql/functions/string/to_base64)

Returns NULL for NULL input.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
base64(value)
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | STRING or BINARY | Yes | Input value. |

## Returns

* Type: STRING
* Possible values: Padded Base64 text.
* NULL behavior: Returns NULL for NULL input.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Usage notes

* Encoding inserts a CRLF line break every 76 characters. Decoding removes CR and LF characters.

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT base64(X'616263') AS "value";
```

| value |
| - |
| YWJj |

### Encode zero and high-byte values

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT base64(X'00FF') AS encoded;
```

| encoded |
| - |
| AP8= |

## Limitations

* Padding and line-break handling can differ for some STRING column representations. Do not rely on identical padding or CR/LF formatting across all input sources.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.