Base64 Encode & Decode

Convert text to Base64 and back with full UTF-8 support (accents, emoji), switch to URL-safe Base64, or drop a file to get its Base64 string or data URI.

Runs in your browser

Encode a file to Base64

Choose a file or drag it here — images, PDFs, fonts, anything up to 50 MB.
The file is read locally and never uploaded.

Your data never leaves your computer. All processing happens 100% locally in your browser.

How to use the Base64 Encode / Decode

  1. Choose Encode to turn text into Base64, or Decode to turn Base64 back into text.
  2. Type or paste into the left box — the result updates instantly. Pasting Base64 in Encode mode offers to switch to Decode.
  3. Tick URL-safe for tokens and URLs (- and _ instead of + and /, no padding).
  4. To encode a file, drop it on the file area; use Copy as data URI to embed it in HTML or CSS.
  5. If decoded data is binary (an image, a PDF…), you get a preview and a Download file button.

What is Base64?

Base64 is an encoding that represents binary data using only 64 printable ASCII characters: A–Z, a–z, 0–9, + and /, with = as padding. It exists so that arbitrary bytes — images, keys, compressed data — can travel through systems built for text, such as email (MIME), JSON payloads, HTML attributes, HTTP headers and environment variables. Base64 is not encryption: anyone can decode it, so never use it to hide passwords or secrets.

How Base64 encoding works

The encoder takes the input three bytes (24 bits) at a time and splits them into four groups of 6 bits. Each 6-bit value (0–63) maps to one character of the alphabet. For example, the text Man is the bytes 4D 61 6E, which become the 6-bit values 19, 22, 5, 46 → TWFu. When the input length isn't a multiple of three, the output is padded with one or two = signs. As a result, Base64 output is always about 33% larger than the original (4 characters for every 3 bytes).

UTF-8 and the “btoa” problem

Base64 encodes bytes, not characters, so text must first be converted to bytes. This tool always uses UTF-8, the encoding of the web. That matters: JavaScript's built-in btoa("é") produces 6Q== (Latin-1), while UTF-8 gives w6k=, and btoa("👋") throws an error. If a decoded string shows garbled characters like é, the original was probably encoded with a different character set.

Standard Base64 vs. Base64URL

Standard (RFC 4648 §4)URL-safe (RFC 4648 §5)
Characters 62 and 63+ and /- and _
Padding= requiredUsually omitted
Used inMIME email, data URIs, PEM keys, Basic AuthJWTs, URL parameters, file names

The decoder accepts both variants, with or without padding and with line breaks, so you can paste values from any source — including full data:image/png;base64,… URIs.

Common uses

  • Data URIs — inline small icons in CSS or HTML (see also the Image to Base64 tool).
  • HTTP Basic Auth — the header is Basic + Base64 of user:password.
  • JWTs — header and payload are Base64URL-encoded JSON; inspect them with the JWT Decoder.
  • Kubernetes secrets — values in a Secret manifest are Base64-encoded.

Tools that pair well with the Base64 Encode / Decode

  • URL Encode / Decode — Percent-encode text for safe use in URLs, decode encoded strings back to readable text, and break any URL down into its parts and query parameters.
  • HTML Entity Encoder — Escape < > & " so text is safe to show in HTML, convert accents and symbols to named or numeric entities, or decode entity-filled HTML back to plain text.
  • UUID Generator — Create cryptographically random UUIDs (v4) or sortable, timestamp-based UUIDs (v7) in bulk, then copy or download them.
  • Unix Timestamp Converter — See the current Unix time live, convert any epoch timestamp (seconds, milliseconds, micro- or nanoseconds) to a date in any time zone, and turn dates back into timestamps.

Frequently asked questions

Is Base64 encryption?
No. Base64 is a reversible encoding with no key — anyone can decode it instantly. Use real encryption (e.g. AES) to protect data, and hashing (see our Hash Generator) for integrity checks.
Why does my decoded text look garbled?
Either the data was binary (an image or compressed file) rather than text, or the text was encoded with a character set other than UTF-8. Binary data is detected automatically and offered as a file download.
Why is Base64 output longer than the input?
Every 3 bytes become 4 characters, so the output is about 33% larger — plus up to 2 padding characters, and a line break every 76 characters if MIME wrapping is on.
What does the = at the end mean?
It is padding. One = means the last group contained 2 bytes, two == means it contained 1 byte. URL-safe Base64 often omits padding; this decoder works either way.
Are my files uploaded?
No. Files are read with the browser’s FileReader API and encoded locally. Nothing is sent to a server.

Related tools