Window atob() Method
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
The numbers in the table specify the first browser version that fully supports the method.
Method | |||||
---|---|---|---|---|---|
atob() | Yes | 10.0 | 1.0 | Yes | Yes |
Syntax
window.atob(encodedStr)
Parameter Values
Parameter | Description |
---|---|
encodedStr | Required. The string which has been encoded by the btoa() method |
Technical Details
Return Value: | A String, representing the decoded string |
---|
Window Object