“Window” object provides two methods for handling String and Base 64 encoded string.
window.btoa()
- This method is for converting a normal string to Bas64 encodes string.
- b(Binary string) to a(Ascii base64 string).
- Example,
var bas64string = window.btoa('Sandeep');
alert(bas64string);//output U2FuZGVlcA==
window.atob()
- This method is for converting Base64 Ascii string to normal string.
- a(Ascii base64 string) to b(Binary string) .
- Example,
var normalString = window.atob(bas64string);
alert(normalString);//output Sandeep
Fiddle Link:-