AIWalay Tools

Base64 Encoder / Decoder

Encode text or files to Base64 and decode Base64 back — UTF-8 safe, with data URI output and file download. 100% in your browser.

About the Base64 Encoder / Decoder

This Base64 encoder and decoder converts in both directions, live, as you type. Enter plain text to see its Base64 form instantly, or paste a Base64 string to decode it back. The conversion is fully UTF-8 safe, so emoji, accents and non-Latin scripts encode and decode correctly — something naive btoa-based tools get wrong.

The File tab converts any file — images, PDFs, fonts, binaries — to Base64, optionally wrapped as a ready-to-use data URI (data:image/png;base64,…) for embedding directly in HTML, CSS or JSON. Going the other way, paste a Base64 string or data URI and download it back as a real file.

Everything happens locally in your browser: no upload, no server, no size logging. That makes it safe for credentials in Basic-Auth headers, private keys and internal documents.

How to Use the Base64 Encoder / Decoder

  1. 1Choose the Text or File tab.
  2. 2Type text in either box — encoding and decoding happen live in both directions.
  3. 3For files, pick a file to get its Base64 (tick the data URI option if needed).
  4. 4To reverse it, paste Base64 and click Decode & download.
  5. 5Copy any result with the copy buttons.

Frequently Asked Questions

What is Base64 encoding used for?

Base64 represents binary data using 64 printable ASCII characters, so it can travel through channels designed for text: JSON payloads, XML, email attachments (MIME), Basic-Auth headers, and data URIs that embed images directly in HTML or CSS. It is an encoding, not encryption — anyone can decode it.

Does this tool handle emoji and non-English characters correctly?

Yes. Text is first converted to UTF-8 bytes with TextEncoder and only then Base64-encoded, and decoding reverses the process with TextDecoder. That means emoji, Chinese, Arabic, Cyrillic and accented characters round-trip perfectly, unlike simple btoa() implementations that throw errors on any character outside Latin-1.

How do I convert an image to a Base64 data URI?

Open the File tab, choose your image and tick "Include data URI prefix". You get a string like data:image/png;base64,iVBORw0… that you can paste straight into an <img src> attribute, a CSS url() value or a JSON field. Small icons are good candidates; large images are usually better served as normal files.

Is my file uploaded when I encode it?

No. The file is read with the browser's FileReader API and encoded in memory on your own device. Nothing is sent over the network, so the tool works offline and is safe for confidential documents.

Why is Base64 output about 33% larger than the original?

Base64 stores every 3 bytes of binary data as 4 text characters, so output is 4/3 of the input size plus a little padding. That overhead is the price of making binary data safe for text-only channels — which is why very large files are usually transferred as binary rather than Base64.

Related Tools