btoa()
AD · 728×90
Google AdSense / Яндекс.Директ
Encoding
btoa()
Encodes a binary string to Base64
→ stringPHP: base64_encode()ES5+
stringstring
String to encode (Latin-1 characters only)
btoa(string)
RESULT
— click Run or press Ctrl+Enter —
Parameter Reference
ParameterTypeStatusDescription
stringstringrequiredString to encode (Latin-1 characters only)
About

btoa() (binary-to-ASCII) encodes a string to Base64 — a text-safe representation using only ASCII characters. Used for HTTP headers, embedding images as data URLs, and Basic Auth credentials. Only accepts Latin-1 characters; for Unicode strings (Cyrillic, emoji) pre-process with encodeURIComponent.

Browser Support

Originally browser-specific, standardized in HTML5 (2014). Available as a global in Node.js since v16. Supported in all modern browsers and IE10+.

Tips & Gotchas