Client-Side Utility

Base64 Encoder & Decoder

Encode UTF-8 text strings or binary files to Base64 format, or decode valid Base64 back into human-readable text entirely within your browser.

Encode File: Load small images, icons, or binary documents (< 2 MB)
0 Characters
0 Characters

1. What is Base64 Encoding?

Base64 is a binary-to-text translation algorithm specified under RFC 4648. It maps raw 8-bit bytes into an ASCII-compatible alphabet comprising 64 characters: uppercase letters (A–Z), lowercase letters (a–z), digits (0–9), and two transmission characters (+ and /). When byte totals do not divide evenly by 3, equal signs (=) serve as padding.

Modern data pipelines use Base64 to transport arbitrary binary or multi-byte textual payloads across legacy transport layers designed exclusively for 7-bit ASCII (such as SMTP email attachments, Data URIs embedded directly in CSS or HTML, and Basic Authentication headers).

2. Encoding Technical Specifications

Parameter Standard Base64 URL-Safe Base64 (RFC 4648 §5)
Character 62 + (Plus sign) - (Hyphen/Minus)
Character 63 / (Slash) _ (Underscore)
Padding Handling Padded with = to multiple of 4 Often omitted or unescaped in query strings
Size Expansion Ratio 4 characters per 3 input bytes (+33.3%) 4 characters per 3 input bytes (+33.3%)
Primary Target MIME, PEM Certificates, Data URIs URL parameters, WebSafe tokens, JWTs

3. Practical Conversion Examples

To verify that your inputs and outputs process as expected, observe these verified test cases:

4. Architectural Distinctions: Encoding vs Encryption

Base64 is strictly a serialization format. It offers zero cryptographic secrecy or integrity:

5. Browser-Side Execution & Data Privacy

All encoding, decoding, and file conversions occur directly inside your browser’s V8/JavaScript execution engine via standard TextEncoder, TextDecoder, and FileReader APIs.

Your inputs, code snippets, tokens, and local files are never uploaded, logged, or saved to our web servers. However, note that third-party resources loaded on this page (such as Google Analytics and Google AdSense) collect standard diagnostic telemetry in accordance with their respective privacy policies.

6. Practical Limitations

7. Frequently Asked Questions

Why do multibyte characters (like emojis) fail in standard btoa()?

JavaScript's legacy window.btoa() function expects each character code to fit within a single 8-bit byte (0 to 255). UTF-8 characters and emojis use between 2 and 4 bytes per code point. This tool uses standard TextEncoder byte streams to represent complex characters correctly before conversion.

How do I use Base64 output in HTML or CSS?

To use Base64 data as an image source without making an extra network request, prepend the correct MIME type Data URI prefix. For example: <img src="data:image/png;base64,iVBORw0KGgo..." alt="Inline Graphic">.

Why are some Base64 outputs padded with equal signs?

Base64 groups binary data into 6-bit chunks. If the final block of input data contains only 1 or 2 bytes instead of 3, padding characters (= or ==) are added to ensure the output string's length remains an exact multiple of 4.

8. Related Developer Utilities