Using JQuery:
Encoding:
$.base64.encode("Demo test text"); Decoding:
$.base64.decode("aghTcycpcyBhIHRlc3Q=");We can also use this where using IE10+
var decod = window.atob(str);
var encode = window.btoa(str);Using AngularJS:
var app = angular.module("encodeDecode", []);
app.controller("encodeDecodeCtrl", ($scope, str) => {
$scope.encode = btoa(str);
$scope.decode = atob(str);
}); 