Base64 Encode / Decode

Encode text or files to Base64, or decode Base64 back to text. Supports URL-safe mode and Data URI output.

About This Tool

Base64 turns any binary data into a safe ASCII string at the cost of a 33% size increase — three bytes of input always become four characters of output. This trade-off is worth it when you need to embed binary content inside JSON, HTML, CSS, URLs, or email bodies that only handle text safely.

All encoding and decoding runs client-side using the browser's native btoa() / atob() and TextEncoder / TextDecoder APIs. No data leaves your browser.

The tool supports standard Base64 and URL-safe Base64, which replaces + with -, / with _, and strips padding characters. This variant is commonly used in JSON Web Tokens (JWTs), URL parameters, and filenames. Toggle Data URI output to generate a complete data: string for embedding images, fonts, and other assets directly in HTML or CSS.

For file encoding, drag and drop a file onto the input area or click to browse. The file is read in the browser and converted to Base64. This is useful for embedding small images as Data URIs or transferring binary payloads as text. In decode mode, you can download the decoded binary as a file. To verify file integrity after transfer, our Hash Generator can compute SHA-256 checksums.

How to Use

  1. Select Encode or Decode from the tabs.
  2. Type or paste text into the Input panel. The output updates instantly.
  3. To encode a file, drag it onto the drop zone or click browse.
  4. Toggle URL-safe for URL-compatible output, or Data URI to generate a complete data URL.
  5. In Decode mode, use the Download button to save decoded binary data as a file.
  6. Click Copy or press Ctrl+Shift+C to copy the output.

About This Tool

View all 25 Base64 guides →

FAQ

Is my data safe?

Yes. Encoding uses the browser's native btoa()/atob() and TextEncoder/TextDecoder APIs — all client-side JavaScript, no network requests. You can confirm this in your browser's DevTools Network tab.

What is URL-safe Base64?

URL-safe Base64 replaces + with - and / with _, and removes trailing = padding. It's used when Base64 data needs to appear in URLs, filenames, or other contexts where standard Base64 characters may cause issues.

What is a Data URI?

A Data URI is a string of the form data:[mime];base64,[data] that embeds file content directly into HTML, CSS, or JavaScript. It's commonly used for small images and fonts to avoid extra HTTP requests.

Does it support Unicode text?

Yes. The tool uses TextEncoder / TextDecoder to handle full Unicode (UTF-8) text correctly.

How large a file can I encode?

There is no hard limit, but very large files (tens of MB) may cause your browser tab to slow down because the entire file is loaded into memory. Keep in mind that Base64 output is always 33% larger than the input. For most practical uses — embedding images, encoding config files — the tool works well.

How do I decode Base64 back to a file?

Switch to Decode mode, paste the Base64 string, and click the Download button in the toolbar to save the decoded bytes as a file.

Related Tools