---
updatedAt: 2025-07-15T08:40:28.000Z
agentTools:
  projectIndex: https://docs.appery.io/llms.txt
---

# EncodeBase64 and DecodeBase64 Server Code System Libraries

# Introduction

Encoding to [base64](https://www.base64decode.org/) is widely used for [Basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) and it is now added to the Appery.io system libraries.\
And so is decoding just in case :)

In this document, we will show how you can use these system libraries in the script.

> 📘 Note
>
> You can find more examples in the **MailgunEmail** [Server Code plugin](https://docs.appery.io/docs/servercode-plugins).

1. Create a new **[Server Code script](https://docs.appery.io/docs/servercode-script)**:

<Image align="center" className="border" border={true} src="https://files.readme.io/654275c-Screenshot_16.png" />

2. Name the script to ***TestEncodeDecodeLibs*** and replace the default script with the below sample code and save:

```typescript Sample Code
const user = "test";
const pass = "123";
const encoded = encodeBase64(user + ":" + pass);
console.log("encoded: " + encoded);
const decoded = decodeBase64(encoded);
console.log("decoded: " + decoded);
```

Here is how the new script should look like:

<Image align="center" className="border" border={true} src="https://files.readme.io/904701a-Screenshot_17.png" />

3. Go to the script **Dependencies** tab and select the libraries:

* **EncodeBase64**
* **DecodeBase64**:

<Image align="center" className="border" border={true} src="https://files.readme.io/28747f9-Screenshot_009.png" />

4. Then go back to the script **Run** tab and test your script:

<Image align="center" className="border" border={true} src="https://files.readme.io/5c84486-Screenshot_39.png" />