coderef

Base64 encoding and decodingBaseline · Widely available

The atob() and btoa() global functions encode and decode strings to and from base 64, respectively.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Sep 20, 2016. Widely available since Mar 20, 2019.

Browser support

DesktopChrome
1–29Not supported
30+Supportedsince Oct 1, 2013
Current: 155
Edge
12+Supportedsince Jul 29, 2015
Current: 154
Firefox
1–3.6Not supported
4+Supportedsince Mar 22, 2011
Current: 157
Safari
1–9.1Not supported
10+Supportedsince Sep 20, 2016
Current: 27
MobileChrome Android
18–29Not supported
30+Supportedsince Oct 2, 2013
Current: 155
Firefox Android
4+Supportedsince Mar 29, 2011
Current: 157
Safari iOS
1–9.3Not supported
10+Supportedsince Sep 13, 2016
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: atob.

Feature detection

JS · check before using
if ("atob" in globalThis) {
  // atob is available
} else {
  // load a polyfill or use a fallback
}

Sub-features

Support for each part of the feature (4). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
atob412131841
atob.worker_support301241030410
btoa412131841
btoa.worker_support301241030410