Base64 Encoder / Decoder
Encode text or files to Base64 and decode Base64 back — URL-safe, MIME wrapping, data URLs, binary round-trips.
🔒
All encoding and decoding happens locally in your browser. No text or files are uploaded to any server.
Variant
Padding
Line wrap
Plain text to encode
Base64 output
Frequently Asked Questions
What is Base64 and when should I use it?
Base64 is an encoding scheme that converts binary data into a string of 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It is widely used to embed binary content — like images, PDFs, or arbitrary bytes — inside text-based formats such as JSON payloads, HTML data URLs, email attachments (MIME), and JWTs. It is an encoding, not encryption — it does not provide any security.
Why does Base64 increase file size by about 33%?
Base64 encodes every 3 bytes of input into 4 ASCII characters. This 4:3 ratio — combined with optional padding — means the output is approximately 133% of the input size (a ~33% overhead). When you add MIME line-breaks every 76 characters, the overhead increases slightly further. This trade-off is worthwhile when the transport layer only supports text.
What is a data URL and how is it used?
A data URL (also called a data URI) embeds file content directly into a URL string using the format
data:[mime-type];base64,[base64-data]. Browsers can render a data URL as an <img> src, a CSS background-image, or an anchor href — no server required. They are ideal for small images or icons that you want to inline into HTML or CSS to save an HTTP request.
What is the URL-safe Base64 variant?
Standard Base64 uses
+ and /, which have special meanings in URLs (+ is a space, / separates path segments). RFC 4648 defines a URL-safe variant that replaces + with - and / with _. This makes the output safe to embed in query strings or path segments without percent-encoding. JWTs, for example, use URL-safe Base64 without padding.
Can I encode and decode binary files like images or PDFs?
Yes. The File → Base64 tab accepts any file type via drag-and-drop or file picker. It reads the raw bytes using
FileReader.readAsDataURL(), then extracts the Base64 payload. The Base64 → File tab reverses the process: it decodes the Base64 string back to a Uint8Array, creates a Blob with the correct MIME type, and triggers a browser download via URL.createObjectURL. Everything stays in your browser — no upload occurs.