Converter Tool

Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 strings instantly. Unicode supported — no signup, no data sent to any server.

In: 0 B·Out: 0 chars
Ratio:

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into a string of 64 printable ASCII characters — the uppercase and lowercase alphabet, digits 0–9, and the symbols + and /. The name comes from the fact that 64 characters can be represented with exactly 6 bits each, making the mapping clean and reversible.

Base64 was designed to solve a specific problem: many text-based protocols (email, XML, JSON, HTTP headers) cannot safely transmit arbitrary binary data. Base64 encodes that binary data as plain ASCII, making it safe to pass through any text channel. Every 3 bytes of binary input become 4 Base64 characters, which means Base64 adds about 33% overhead compared to the raw binary.

This free online Base64 encoder/decoder runs entirely in your browser — no data ever leaves your device. It also handles full Unicode text, including emoji and non-Latin scripts, using the standard encodeURIComponent / btoa chain so that multi-byte characters are encoded correctly.

When Should You Use Base64?

Base64 is the right choice in several common scenarios:

  • Embedding images in HTML or CSS — Data URIs use Base64 to inline small images directly in markup, avoiding an extra HTTP request.
  • Email attachments (MIME) — SMTP was designed for 7-bit ASCII. Base64 encodes binary attachments so they survive transit through legacy mail servers.
  • Storing binary data in JSON or XML — JSON has no native binary type. Certificates, keys, images, and audio blobs are routinely Base64-encoded before being placed in JSON payloads.
  • Basic Auth HTTP headers — Credentials are Base64-encoded (not encrypted) before being placed in the Authorization header.
  • JWT tokens — JSON Web Tokens use Base64URL (a URL-safe variant) to encode their header and payload sections.

How to Encode and Decode Base64 Online

  1. 1.The tool starts in Encode mode. Paste or type any text — including Unicode — into the top panel.
  2. 2.The Base64-encoded output appears instantly in the bottom panel. The animated transform band shows input bytes, output character count, and the encoding ratio.
  3. 3.Click Encode ⇄ Decode in the center band to switch to decode mode. The current output moves to the input automatically.
  4. 4.Paste a Base64 string and the decoded plain text appears in the output panel. If the string is malformed, a red error message explains the problem.
  5. 5.Use Copy to copy the output to clipboard, Download to save as a file, or Clear to reset.

Base64 vs Hex vs URL Encoding

Base64 is one of several encoding schemes used to represent binary data as text. Here is how the main options compare:

  • Base64 — Encodes every 3 bytes as 4 characters using a 64-character alphabet. ~33% size overhead. Ideal for email, JSON, HTTP headers, and data URIs.
  • Hex (Base16) — Encodes every byte as 2 hexadecimal characters. 100% size overhead but extremely readable and common in debugging, hashes, and cryptographic outputs.
  • URL encoding (percent encoding) — Replaces non-URL-safe characters with %XX sequences. Used specifically for encoding query strings and path segments in URLs — not for general binary data.
  • Base64URL — A URL-safe variant of Base64 that replaces + with - and / with _, and omits padding. Used in JWT tokens and many modern APIs.

Choose Base64 when you need compact, portable text representation of binary data. Choose Hex when human readability and debuggability matter more than size. Use URL encoding only for query parameters and URL path components.