JavaScript: Decode a string of data which has been encoded using base-64 encoding
JavaScript fundamental (ES6 Syntax): Exercise-259 with Solution
Decode Base-64 String
Write a JavaScript program to decode a string of data encoded using base-64 encoding.
Note: Create a Buffer for the given string with base-64 encoding and use Buffer.toString('binary') to return the decoded string.
- Create a Buffer for the given string with base-64 encoding and use Buffer.toString('binary') to return the decoded string.
Sample Solution:
JavaScript Code:
Flowchart:

For more Practice: Solve these Related Problems:
- Write a JavaScript program that decodes a Base-64 encoded string using atob() in the browser.
- Write a JavaScript function that converts a Base-64 string to its original representation and logs the result.
- Write a JavaScript program that handles errors during Base-64 decoding and returns a fallback message.
- Write a JavaScript function that decodes a Base-64 encoded string and verifies the output against expected plain text.
Go to:
PREV : Limit Function Arguments.
NEXT : Binomial Coefficient.
Improve this sample solution and post your code through Disqus
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.