Decoding base64 “atob” in Javascript NodeJS

atob() is a javascript function that decodes base64 encoded text. btoa() is the encoding function. We can use NodeJS to dedcode atob() functions. For instance, we can lanch nodejs woth


and decode the sting SGVsbG8gV29ybGQgIQ==


If we wanted to break that down into a couple variables we can do something like the following.

> var b64 = atob("SGVsbG8gV29ybGQgIQ==")
> console.log(b64");

You can also create a javascript file and then run the file with nodejs.

var b64 = atob(atob("U0dWc2JHOGdWMjl5YkdRZ0lRPT0="))


We can then run the file with

nodejs ./file.js

In the file the string “Hello World !” is double encoded so we process it twice with the “atob(atob(base64);”

There is more info available at the following links

Check out the following article if you want to use Python to decode base64.