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

# base64_decode_string

> Alias of from_base64; decodes a Base64-encoded string to its original string value.

This function is the same as [from\_base64](/documents/4.2/sql-reference/sql-functions/crytographic-functions/from_base64.md).
Decodes a Base64-encoded string. and an inverse of [to\_base64](/documents/4.2/sql-reference/sql-functions/crytographic-functions/to_base64.md).

This function is supported from v3.0.

## Syntax

```Haskell theme={null}
base64_decode_string(str);
```

## Parameters

`str`: the string to decode. It must be of the VARCHAR type.

## Return value

Returns a value of the VARCHAR type. If the input is NULL or an invalid Base64 string, NULL is returned. If the input is empty, an error is returned.

This function accepts only one string. More than one input string causes an error.

## Examples

```Plain Text theme={null}

mysql> select base64_decode_string(to_base64("Hello StarRocks"));
+----------------------------------------------------+
| base64_decode_string(to_base64('Hello StarRocks')) |
+----------------------------------------------------+
| Hello StarRocks                                    |
+----------------------------------------------------+
```


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