Browser Support for base-64 encoding

Encode a string in base-64:

var str = “Hello World!”;
var enc = window.btoa(str);

var res = “Encoded String: ” + enc;

The result of res will be:

Encoded String: SGVsbG8gV29ybGQh