AD · 728×90
Google AdSense / Яндекс.Директ
Google AdSense / Яндекс.Директ
Encoding
btoa()
Encodes a binary string to Base64
String to encode (Latin-1 characters only)
btoa(string)
RESULT
— click Run or press Ctrl+Enter —
Parameter Reference
| Parameter | Type | Status | Description |
|---|---|---|---|
| string | string | required | String 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
- For Unicode strings use: btoa(unescape(encodeURIComponent(str)))
- Base64 increases data size by ~33%
- btoa() is not encryption — Base64 is trivially reversible with atob().