Basically, it can be done using some browsers which can support such as Firefox, Chrome, Safari, etc. They are using functions called btoa() and atob(). Also, for the server-side JavaScript, you can able to use buffers to decode.
I hope this will help.
Want to know more about Java? Prefer this tutorial on Learn Java.
Want to become a Java Expert? Join Java Training now!!