Skip to content

Instantly share code, notes, and snippets.

@soiqualang
Created December 14, 2020 09:30
Show Gist options
  • Save soiqualang/d04e4899b742adb04fa6e87cccc8b387 to your computer and use it in GitHub Desktop.
Save soiqualang/d04e4899b742adb04fa6e87cccc8b387 to your computer and use it in GitHub Desktop.
JavaScript decode base64
// Define the string
var string = 'Hello World!';

// Encode the String
var encodedString = btoa(string);
console.log(encodedString); // Outputs: "SGVsbG8gV29ybGQh"

// Decode the String
var decodedString = atob(encodedString);
console.log(decodedString); // Outputs: "Hello World!"

//---------------
var encodedString='IyBwb3N0Z3Jlc3FsX3Rvb2wKcG9zdGdyZXNxbF90b29sCgpodHRwOi8vYXBw\ncy5kb3RoYW5obG9uZy5vcmcvcG9zdGdyZXNxbF90b29sLwo';
var decodedString = atob(encodedString);
console.log(decodedString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment