Base64 Encoder / Decoder (Text & Files)
Encode and decode Base64 data directly in your browser. Safely convert Unicode text and emojis with native UTF-8 support, generate URL-safe Base64 strings, convert local images into embeddable HTML data-URIs, and decode Base64 payloads back into downloadable binary files โ 100% private.
Base64 Converter Workbench
0 chars
0 chars
Ratio: 0.0%
How to Encode and Decode Base64
- Text Encoding: Paste any plain text (including Unicode characters, emoji, or JSON) into the Input String box and click "Encode to Base64".
- Text Decoding: Paste a Base64 string into the input box and click "Decode from Base64" to reveal the original readable text.
- Convert Images to Data-URIs: Switch to the "File & Image Mode" tab, drag and drop any image file, and instantly copy the CSS/HTML embeddable
data:image/png;base64,...string. - Decode Base64 Back to Binary Files: Paste an encoded Base64 string into the decode box, enter the target MIME type, and click "Download Decoded File" to regenerate the original file.
What is Base64 Encoding and When Should You Use It?
Base64 is a binary-to-text encoding scheme defined in RFC 4648 that translates binary data (arbitrary 8-bit octets) into a radix-64 representation using 64 ASCII characters (A-Z, a-z, 0-9, +, and /).
Common real-world applications:
- Inlining Small Web Assets: Embedding small UI icons, logos, or fonts directly into CSS stylesheets or HTML documents via Data-URIs to eliminate extra HTTP network requests.
- API Credentials & Basic Auth: HTTP Basic Authentication headers encode
username:passwordpairs into Base64 (e.g.,Authorization: Basic dXNlcjpwYXNz). - Email Attachments (MIME): Email protocols like SMTP were originally designed exclusively for 7-bit ASCII text. Base64 allows binary file attachments to travel across email gateways reliably.
- JSON Web Tokens (JWT): JWT headers and claims payloads are encoded in URL-safe Base64 (Base64URL) for safe transmission in HTTP request headers.
Key Features
- Full UTF-8 Support: Handles international characters, diacritics, and emojis without standard browser
btoa()Latin1 exceptions. - URL-Safe Mode: Replaces
+and/with-and_and strips padding for safe use in web URLs. - Client-Side File Processing: Reads local files instantly using HTML5 FileReader with zero server uploads.
- Live Image Preview: Immediate visual feedback for decoded and encoded image assets.
- Binary Export: Decode Base64 strings directly into downloadable file blobs.
Privacy & Data Security
All encoding and decoding operations in this tool run 100% locally in your web browser. Neither your text strings nor your uploaded images and documents are sent to any remote server or stored in cookies. You can safely convert confidential certificates, authentication headers, and private keys.
Frequently Asked Questions
- How does this tool handle UTF-8 Unicode characters without corruption?
- Standard browser window.btoa() fails on characters outside the Latin1 range (such as emojis, accented letters, and Asian characters). Our tool uses TextEncoder and TextDecoder to serialize strings into raw UTF-8 byte arrays before encoding, ensuring zero character corruption.
- What is URL-Safe Base64?
- Standard Base64 contains '+' and '/' characters, as well as '=' padding, which have reserved meanings in URL query strings and path segments. URL-safe Base64 (RFC 4648 ยง5) replaces '+' with '-' and '/' with '_', and omits trailing '=' padding.
- Why does Base64 increase file size by roughly 33%?
- Base64 represents binary data using 6 bits per ASCII character (2^6 = 64 characters). Since each raw byte contains 8 bits, 3 raw bytes (24 bits) require 4 Base64 characters (24 bits), resulting in a mathematically consistent 4/3 (approx. 33.3%) overhead.