Base64 Encoder / Decoder

Convert text to Base64 and back, turn an image or other file into a Base64 string or data URI, or decode a Base64 blob into the original file.

Encoding and decoding happen in your browser. Your text and files are never uploaded.

Encode a file

How to use the Base64 tool

  1. Choose Encode to turn text into Base64, or Decode to turn Base64 back into text. The result updates as you type.
  2. Tick URL-safe when the result will be placed in a URL, filename or JWT.
  3. To encode a file — an image, PDF, font or anything else — use the file box. You can copy the plain Base64 or a complete data: URI.
  4. If decoded data is not readable text (for example, an image), click Download decoded file. The file type is detected from its first bytes.

What Base64 is

Base64 represents any binary data using only 64 safe characters: A–Z, a–z, 0–9, + and /, with = used for padding at the end. Every 3 bytes of input become 4 characters, so Base64 text is about 33% larger than the original.

It's used wherever binary data has to travel through systems designed for text: email attachments (MIME), images embedded in HTML or CSS as data URIs, HTTP Basic authentication headers, JSON Web Tokens, and API payloads.

Base64 is not encryption. Anyone can decode it instantly. Never use it to hide passwords or secrets.

Text encoding and URL-safe Base64

Text is converted to bytes using UTF-8 before encoding, so accented letters, non-Latin scripts and emoji round-trip correctly. (The browser's built-in btoa() function fails on such characters — a common source of “InvalidCharacterError”.)

URL-safe Base64 (Base64URL, RFC 4648 §5) replaces + with - and / with _, and usually drops the = padding, because those characters have special meanings in URLs. The decoder here accepts both alphabets, missing padding, line breaks and a leading data:…;base64, prefix, so you can paste almost anything.

Frequently asked questions

Is Base64 encryption?

No. It is a reversible encoding with no key; anyone can decode it. Use it to transport data, not to protect it.

Why is my Base64 string longer than the original?

Base64 uses 4 characters for every 3 bytes, so the output is about one third larger, plus up to two “=” padding characters.

How do I turn an image into a data URI?

Drop the image into the “Encode a file” box and click “Copy data URI”. You can paste the result into the src attribute of an image tag or into a CSS url(). This is best for small images; large ones make your HTML or CSS heavy.

Are my files uploaded?

No. Files are read with the browser’s FileReader and encoded on your device. Nothing is sent over the network.