Base64 Encode / Decode

Encode text and files to Base64, or decode Base64 strings back to text and downloadable files. Supports images, PDFs, and any file type. 100% client-side — your data never leaves your browser.

100% Private

All encoding and decoding happens in your browser using JavaScript's built-in APIs. Your text, files, and images are never uploaded to any server.

Files & Images

Drop any file — PNG, JPEG, PDF, SVG, Word doc — and get the Base64 data URL instantly. Perfect for embedding images in CSS, HTML, or JSON payloads.

Full Unicode

Handles emojis, CJK characters, Arabic, Hebrew, and any UTF-8 text correctly. Uses the modern TextEncoder/TextDecoder APIs — no data corruption.

How to Encode Text to Base64

  1. Select the Encode → Base64 tab.
  2. Choose Text if encoding a string, or File / Image if encoding a file.
  3. Type or paste your text in the left box — the Base64 output appears instantly on the right.
  4. For files, drop or click to upload. The Base64 data URL appears below, with an image preview for image files.
  5. Click Copy to copy the output to your clipboard.

How to Decode Base64

  1. Select the Decode ← Base64 tab.
  2. Paste your Base64 string into the left box. Whitespace is stripped automatically.
  3. The decoded text appears on the right. For data URLs (data:image/png;base64,…), the image is rendered inline.
  4. Use Download file to save a decoded binary file (image, PDF, etc.).

What is Base64?

Base64 is an encoding scheme defined in RFC 4648 that represents binary data using 64 printable ASCII characters: A–Z, a–z, 0–9, +, and /, with = used as padding. The name comes from the alphabet size: 2⁶ = 64.

Every 3 bytes of input become 4 Base64 characters. This means encoded output is roughly 33% larger than the original. Base64 is not compression — it trades size for text-safe representation.

Common Uses of Base64

Use caseExample
HTTP Basic AuthAuthorization: Basic dXNlcjpwYXNz
Embed images in HTML/CSSsrc="data:image/png;base64,iVBOR…"
JSON API payloads{ "file": "JVBERi0xLjQ…" }
Email attachments (MIME)Content-Transfer-Encoding: base64
JWT token partseyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1MSJ9…
CSS font embedding@font-face { src: url('data:font/woff2;base64,…') }
SVG inline in HTMLbackground-image: url('data:image/svg+xml;base64,…')

Base64 vs Base64URL

Standard Base64 uses + and / — characters that have special meaning in URLs. Base64URL (defined in RFC 4648 §5) replaces them with - and _and omits the = padding, making it safe to embed in URLs and cookie values without percent-encoding. JWTs use Base64URL for their header and payload sections.

Base64 for HTTP Basic Authentication

HTTP Basic Auth sends credentials as username:password encoded in Base64. To construct the header manually:

  1. Paste username:password (with the colon) into the Encode text box.
  2. Copy the Base64 output.
  3. Use it as: Authorization: Basic <output>

Remember: Basic Auth is only secure over HTTPS. Anyone who intercepts the header can trivially decode it — Base64 is not encryption.

Frequently Asked Questions

What is Base64 encoding?

Base64 converts binary data into 64 printable ASCII characters so it can be safely embedded in text-based formats like JSON, XML, HTML, HTTP headers, and email. It is not encryption — anyone can decode it without a key.

Does Base64 encrypt my data?

No. Base64 is encoding, not encryption. The encoded string can be decoded by anyone with a Base64 decoder. If you need to protect data, use a real encryption algorithm like AES-256.

Is my data uploaded to a server?

No. Everything happens in your browser using JavaScript's built-in btoa(), atob(), TextEncoder, TextDecoder, and FileReader APIs. Your files and text never leave your device.

How do I embed an image in HTML using Base64?

Upload your image in the File / Image tab, copy the data URL output, and use it as an <img> src: <img src="data:image/png;base64,iVBOR…">. The browser renders the image directly from the string — no separate file request needed.

Why does the encoded output end with = or ==?

Base64 encodes every 3 bytes into 4 characters. If the input length is not a multiple of 3, one or two = padding characters are appended to make the output length a multiple of 4. This is required by the specification.