files/en-us/web/api/workerglobalscope/atob/index.md
{{APIRef("HTML DOM")}}{{AvailableInWorkers("worker")}}
The atob() method of the {{domxref("WorkerGlobalScope")}} interface decodes a
string of data which has been encoded using {{glossary("Base64")}} encoding. You can use
the {{domxref("WorkerGlobalScope.btoa()")}} method to encode and transmit
data which may otherwise cause communication problems, then transmit it and use the
atob() method to decode the data again. For example, you can encode,
transmit, and decode control characters such as {{Glossary("ASCII")}} values 0 through 31.
atob(encodedData)
encodedData
An ASCII string containing decoded data from encodedData.
InvalidCharacterError {{domxref("DOMException")}}
encodedData is not valid base64.const encodedData = self.btoa("Hello, world"); // encode a string
const decodedData = self.atob(encodedData); // decode the string
{{Specifications}}
{{Compat}}
atob is available in core-jsdata URLs