window.atob() decodes a base64-encoded string, and window.btoa() creates a base64-encoded string from binary data. window.btoa() is useful for creating data: URI.

atob() and btoa() work on Firefox 2+, safari 3.1+, Opera and Google chrome.

Test