Base64 Encoder & Decoder

Encode text or files to Base64, decode Base64 strings back to text. Free, instant, no signup.

ADSENSE_SLOT_TOP

Text to Encode 0 chars

Encoded Output
ADSENSE_SLOT_MIDDLE

How to Use This Base64 Encoder

  1. Choose Encode or Decode โ€” Use the tabs above to switch modes. The tool also auto-detects: if your input looks like Base64, it switches to Decode automatically.
  2. Enter your text โ€” Encode mode: type or paste any text (Unicode, emoji, etc.). Decode mode: paste a Base64 string.
  3. For files, click Upload File โ€” In Encode mode, upload any file (image, PDF, etc.) to convert it to a Base64 data URL. The encoded string can be embedded directly in HTML, CSS, or JSON.
  4. Copy, Swap, or Clear โ€” Click Copy to copy the result, Swap to flip input and output (useful for round-trip testing), or Clear to reset.

Tip: Use Ctrl + Enter to trigger encode/decode, or Ctrl + , to swap input/output.

Why Use This Base64 Encoder?

Proper Unicode support

Many Base64 tools fail with non-Latin text because they use JavaScript's btoa() directly, which only handles Latin-1 characters. This tool properly encodes to UTF-8 bytes first, so Chinese, Japanese, Korean, Arabic, and emoji characters work correctly.

Complete privacy

All processing happens in your browser. Your text and files never leave your device โ€” no uploads, no server logs, no tracking. Safe for sensitive data, API keys, and proprietary documents.

File to Base64 conversion

Upload any file to encode it as a Base64 data URL. The output includes the MIME type and can be embedded directly in HTML <img> tags, CSS url() values, or JSON payloads.

Auto-detect and URL-safe support

The tool detects whether your input is plain text, standard Base64, or URL-safe Base64 (using - and _ instead of + and /), and handles each case automatically.

Frequently Asked Questions

What is Base64 encoding used for?

Base64 is used to represent binary data as ASCII text. Common uses include: embedding images in HTML/CSS with data URLs, sending attachments in email (MIME), storing binary data in JSON or XML, encoding credentials in HTTP Basic Auth headers, and transmitting binary data through text-only channels.

Why does Base64 make data 33% larger?

Base64 uses 64 characters (6 bits each) to represent data that originally uses 8 bits per byte. Every 3 original bytes become 4 Base64 characters: 3 ร— 8 = 24 bits โ†’ 4 ร— 6 = 24 bits. The 4/3 ratio means ~33.3% size increase.

Can I decode Base64 back to the original text?

Yes. The encoding is fully reversible. Switch to Decode mode, paste your Base64 string, and the original text is restored. This tool uses UTF-8 for text encoding, so any Unicode text round-trips perfectly.

What is the difference between standard and URL-safe Base64?

Standard Base64 uses +, /, and = padding. URL-safe Base64 (RFC 4648 ยง5) replaces + with - and / with _, and often omits padding. This makes it safe for URLs and filenames without percent-encoding.

Is this Base64 tool free?

Yes, completely free. No signup, no download, no limits on usage.

More Free Tools

Browse other free online tools from TryTools โ€” all run in your browser with no signup required.