Javascript has a built in atob and btoa function.
<script type="text/javascript">
function doAtob() {
var val = document.getElementById("inputbox").value;
var out = document.getElementById("outval");
out.appendChild(document.createTextNode(atob(val)));
}
</script>
<input id="inputbox" type=textbox />
<button onclick='doAtob()'>Do it!</button>
<span id="outval" />
solved How Do I Execute btoa(string); using HTML and JS