How to Decode Base64 Strings to Text in JavaScript?

Estimated read time 1 min read

In JavaScript, you can use the atob() function to decode Base64 strings to text. The atob() function decodes a Base64 encoded string to its original form.

Here’s an example:

const encodedString = 'SGVsbG8gV29ybGQh';
const decodedString = atob(encodedString);
console.log(decodedString); // 'Hello World!'

In this example, the Base64 encoded string 'SGVsbG8gV29ybGQh' is decoded using the atob() function, and the resulting decoded string 'Hello World!' is logged to the console.

You May Also Like

More From Author

+ There are no comments

Add yours

Leave a Reply