Base64 Encoder / Decoder

Encode or decode Base64 text and files, with URL-safe output.

Loading tool…
Free, no sign up. Runs in your browser, so your data never leaves your device.

What is Base64?

Base64 is a way of writing any data, including images and other binary files, using only 64 safe characters: the letters A to Z and a to z, the digits 0 to 9, plus + and /. Many systems, such as email, JSON documents, HTML attributes and HTTP headers, were designed for text and can damage raw binary data. Encoding the data as Base64 lets it travel safely through these systems. The cost is size: Base64 output is about one third larger than the original.

Base64 is an encoding, not encryption. Anyone can decode it, so never use it to hide passwords or secrets.

How to use the Base64 tool

  1. On the Text tab, type or paste your text and click Encode to Base64.
  2. To decode, paste a Base64 string and click Decode from Base64.
  3. Tick URL-safe to use - and _ instead of + and / and drop the padding.
  4. On the File to Base64 tab, choose any file to get its Base64 text, with or without a data URI prefix.
  5. Copy the result or download it as a file.

Features

  • Full UTF-8 support, so accented letters, Chinese, Arabic and emoji encode and decode correctly.
  • Tolerant decoding that accepts standard or URL-safe Base64, missing padding, line breaks and a data URI prefix.
  • Binary detection: if decoded data is not text, the tool tells you and lets you download it as a file.
  • File conversion for files up to 25 MB, showing the original size and the Base64 length.

Common uses for Base64

Web developers embed small icons and fonts in CSS or HTML as data URIs, which saves an extra request. API developers send file uploads inside JSON bodies as Base64 strings. Basic HTTP authentication headers contain a Base64 encoded user name and password. JSON Web Tokens use URL-safe Base64 for each of their three parts, and email attachments are encoded with Base64 under the MIME standard.

Standard vs URL-safe Base64

Standard Base64 uses + and /, which have special meanings in URLs and file names. The URL-safe variant, defined in RFC 4648, swaps them for - and _ and usually leaves off the trailing = padding. Use it whenever the encoded value goes into a query string, a path or a cookie.

Tips

Only inline small images as data URIs. Large images are better served as normal files, because the Base64 version is bigger and cannot be cached separately by the browser.

Frequently asked questions

Is Base64 a form of encryption?

No. Base64 only changes how data is written. Anyone can decode it instantly, so it gives no protection for secrets.

Why does decoding show strange characters?

The original data was probably a binary file such as an image, not text. The tool detects this and offers a Download decoded file button so you can save the real file.

Can I convert an image to a data URI?

Yes. Use the File to Base64 tab and keep the data URI option ticked. The result can be pasted into an img src attribute or a CSS url().

Is there a file size limit?

Files up to 25 MB can be converted. Larger files create Base64 text that is too big to handle comfortably in a browser.