Window atob() in JavaScript

Overview
The Window atob() in JavaScript is used to decode a base-64 encoded string. atob in the JS method is used for decoding data encoded with btoa(). Decoding returns a string representing the decoded string.
Syntax of Window atob() in JavaScript
The syntax of Window atob() in JavaScript is given as:
Parameters of Window atob() in JavaScript
The following parameter of atob in JS is:
encodedData - The string which is to be decoded. It is a binary string that contains base64-encoded data. In a binary string, each character is treated as a byte of binary data.
It is mandatory to provide a parameter to the Window atob() in JavaScript.
Return Value of Window atob() in JavaScript
atob in JS returns decoded data from encodedData as an ASCII string.
Exceptions of Window atob() in JavaScript
InvalidCharacterError - Window atob() in JavaScript throws an error when the encodedData is not a valid base64 string.
Base64 string is an encoded string that represents binary data in an ASCII string
Example
Output
What is Window atob() in JavaScript?
Window atob() in JavaScript decodes a string of data encoded with Base64 encoding using the atob() function.
To encode and transmit data that may otherwise cause communication problems, you can then use the btoa() method to encode your data, then transmit it and use the atob() method to decode it again.
More Examples
The example below illustrates the use of the Window atob() in JavaScript.
Output

Supported Browsers
Window atob() in JavaScript supports the following browsers:
| Browser | Version |
|---|---|
| Edge | 12 |
| Internet Explorer | 10 |
| Opera | 10.5 |
| Firefox | 1 |
| Safari | 3 |
| Google Chrome | 4 |
Conclusion
- The Window atob() in JavaScript stands for ASCII to binary.
- A base-64 encoded string can be decoded with the Window atob() in JavaScript.
- The parameter passed onto the Window atob() in JavaScript must be a valid base64 string.
- A base64 string is an encoded string that represents binary data in an ASCII string.
- It returns the decoded string.
- The atob() and btoa() methods allow developers to transform data to and from the base64 encoding.