X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Window atob() Method

Window Object Reference Window Object

Example

Decode a base-64 encoded string:

var str = "Hello World!";
var enc = window.btoa(str);
var dec = window.atob(enc);

var res = "Encoded String: " + enc + "<br>" + "Decoded String: " + dec;

The result of res will be:

Encoded String: SGVsbG8gV29ybGQh
Decoded String: Hello World!

Try it yourself »


Definition and Usage

The atob() method decodes a base-64 encoded string.

This method decodes a string of data which has been encoded by the btoa() method.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The atob() method is supported in all major browsers.


Syntax

window.atob(encodedStr)

Parameter Values

Parameter Description
encodedStr Required. The string which has been encoded by the btoa() method

Return Value

Type Description
String The decoded string


Window Object Reference Window Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook