🇨🇳 中文

Base64 Encode Online

Convert text, images or files to Base64 instantly — no upload required, 100% private.

What & Why of Base64 Encoding

What is Base64 encoding?

Base64 converts binary data into an ASCII string using 64 printable characters (A–Z, a–z, 0–9, +, /). It was originally designed to embed files inside text-based protocols like e-mail.

Why encode files to Base64?

  • Embed small images directly in CSS or HTML with data URIs, reducing HTTP requests.
  • Transmit files over JSON or XML APIs that only accept text.
  • Store binary configurations in JSON, JWT, or environment variables.
  • Avoid corruption when copying files through clipboard or chat.

Is Base64 an encryption?

No. It provides zero cryptographic security; it only changes the representation. Do not use it to hide sensitive data—use proper encryption instead.

Size overhead

Encoding increases volume by ~33 % (3 bytes → 4 characters). Use it only when text transport is mandatory.

Browser support

Native methods:

// encode
const base64 = btoa(binaryString);
// decode
const binary = atob(base64);

For Unicode, convert to UTF-8 first via TextEncoder.

Common variants

  • Base64URL: Replaces '+/=' with '-_' and no padding, safe for URLs.
  • Base58: Bitcoin addresses, removes visually similar characters.
  • Base32: Case-insensitive scenarios (e.g., Google Authenticator secrets).

Bottom line

Base64 turns "binary → text" so your data can travel safely through text-only channels. It's encoding, not encryption—use wisely and sparingly.