# llBase64ToString

*LSL function*

```lsl
string string llBase64ToString(string str);
```

- `string str`: Base64-encoded string to decode.

- Returns: `string`
- Energy: 10

Decodes the Base64-encoded string str into a conventional string, interpreting the bytes as a UTF-8 character sequence. Unprintable characters are converted to question marks.

Returns a [string](https://wiki.secondlife.com/wiki/string) that is the [Base64](https://wiki.secondlife.com/wiki/Category:LSL_Base64) **str** decoded into a conventional string, interpreting the Base64-encoded bytes as UTF-8 character sequence.

```lsl title="How to use" frame="terminal"
string result = llBase64ToString("");
```

## Caveats

- If the conversion creates any unprintable characters, they are converted to spaces.
- Converts invalid characters into question marks ('?').

## Examples

<details open>
<summary>Example 1</summary>

```lsl
default {
    state_entry()
    {
        string test = llBase64ToString("U2VjcmV0Ok9wZW4=");
        llSay(0,test );
    }
}
```

</details>

<details>
<summary>This can be used in [Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication), such as this login:</summary>

```lsl
GET / HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2)
Host: www.example.com
Authorization: Basic U2VjcmV0Ok9wZW4=
```

</details>

<details>
<summary>Example 3</summary>

```lsl
llBase64ToString("U2VjcmV0Ok9wZW4="); //will return the string "Secret:Open"
```

</details>

## See also

### Functions

- [llXorBase64](/functions/llXorBase64/) — Article also discusses xor based Cryptography.
- [llStringToBase64](/functions/llStringToBase64/)
- [llBase64ToInteger](/functions/llBase64ToInteger/)

### Articles

- [Base64](https://wiki.secondlife.com/wiki/Category:LSL_Base64)

---

*Source: [LlBase64ToString](https://wiki.secondlife.com/wiki/LlBase64ToString) on the Second Life Wiki. Content from the Second Life Wiki article LlBase64ToString (revision 1216098, 2024-01-24), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llBase64ToString/
