Window atob() method
Definition and Usage
The atob() method is used to decode a string encoded with base-64.
The base-64 encoding usage is btoa() .
Syntax
window.atob(encodedStr)
Parameter Description:
- encodedStr: Required, a string encoded by the btoa() method.
Return Value
This method returns a decoded string.
Browser support
The numbers in the table indicate the first browser version that supports this method.
| Method | |||||
|---|---|---|---|---|---|
| atob() | Yes | 10.0 | 1.0 | Yes | Yes |
Example
Example
Display an alert box:
var
str
=
"
RUNOOB
"
;
var
enc
=
window
.
btoa
(
str
)
;
var
dec
=
window
.
atob
(
enc
)
;
var
res
=
"
The encoded string is:
"
enc
"
"
"
The decoded string is:
"
dec
;
Try it »
Window Object