Base64 Encoder and Decoder

Encode text, images, and any file to Base64, or decode Base64 back to readable text. Turn on Auto to let the tool detect the direction, plus URL-safe output, MIME line breaks, and an image preview with a data URI, all processed on your device.

Text input

Base64 output

File to Base64

Drop a file here or choose from your device

Any file becomes Base64. Images get a preview and can be exported as a data URI.

Input: 0 chars · 0 bytesOutput: 0 chars

Choose Encode, Decode, or Auto, then paste your text or Base64.

Encoding and decoding run in this browser. Your text and files are not sent to a server.

Base64 is a way of writing data using only letters, digits, and two symbols, so the result can pass safely through systems that expect plain ASCII. This tool converts your text, images, or files to Base64 and converts Base64 back to text, and because it works in UTF-8 it keeps emoji and non-Latin characters intact. Everything runs in your browser, so what you paste or drop stays on your device.

How to use the Base64 encoder and decoder

  1. Choose Encode, Decode, or Auto — Pick Encode to turn text or a file into Base64, Decode to turn Base64 back into text, or Auto to let the tool detect the direction from your input.
  2. Add your input — Paste text into the box, or drop a file (an image works too) on the file area.
  3. Pick your options — Turn on URL-safe, MIME line breaks, or a data URI, and switch on Live to convert as you type.
  4. Convert and copy — Choose Convert if Live is off, then copy the output or download the decoded file.

When you encode, the tool reads your input as UTF-8, so accented letters, Japanese and Chinese text, and emoji all survive the round trip. When you decode, it checks both the Base64 and the bytes it produces — if the input is not valid Base64, or the bytes are not valid UTF-8, it shows an error instead of a garbled result.

Auto-detect the direction

If you would rather not think about which way to convert, choose Auto. The tool looks at what you pasted: if it is valid Base64 that decodes to readable text, it decodes it, and the status line reports “Detected Base64 input and decoded it.” If the input is anything else, the tool treats it as text and encodes it to Base64 instead. Live mode follows the same rule, so the direction is chosen for you as you type.

Standard Base64 vs URL-safe Base64

Standard Base64 represents every three bytes of data as four characters drawn from a 64-character alphabet: A–Z, a–z, 0–9, plus + and /. It also pads the end with = so the length is a multiple of four. The trade-off is that +, /, and = are not always welcome in a URL, a filename, or a query string.

URL-safe Base64 solves that by swapping + for - and / for _, and dropping the = padding, so the value can be pasted into a link without escaping. Turn on the URL-safe option and the output is rewritten that way. Decoding accepts both alphabets at once — standard +//, URL-safe -/_, and values with or without padding — so you do not have to tell it which one you pasted.

Files, images, and data URIs

Drop a file on the file area, or use Choose a file, to encode its bytes rather than its text. The file is read in your browser with the File API, so nothing is uploaded. When the file is an image, the tool shows a preview next to the result. Turn on Include data URI to emit data:<mime>;base64,<characters> instead of a bare Base64 string — the form you paste straight into a CSS url() or an <img src>.

MIME line breaks

Some formats, such as email bodies and certain headers, expect Base64 to be wrapped at 76 characters per line. Turn on Line breaks (MIME 76) and the output is chunked that way. The decoder ignores whitespace and line breaks, so a MIME-wrapped value still decodes back to exactly the same bytes.

Is it private?

Yes. Encoding and decoding run entirely in your browser using built-in JavaScript APIs, and nothing you paste or drop is sent to a server, stored, or logged. Files you open are read locally through the browser’s file reader and are never transmitted. There is no account to create and no history kept on our side, so closing the tab clears the input and output from view.

Frequently asked questions

How does Auto mode decide the direction?

In Auto mode the tool inspects your input. If it is valid Base64 that decodes to text, the tool decodes it; otherwise it treats the input as text and encodes it to Base64. The status line tells you which direction was used.

Can I encode a file or image to Base64?

Yes. Drop a file on the file area or choose one with the file picker, and the tool reads it in your browser and encodes its bytes. Images get a preview, and you can output a data URI instead of plain Base64.

Does ToolNava support URL-safe Base64?

Yes. Turn on the URL-safe option and the output swaps + for - and / for _, and drops the = padding. Decoding accepts both standard and URL-safe input, with or without padding.

What are MIME line breaks for?

MIME limits Base64 in email and some headers to 76 characters per line. Turn on the Line breaks option to wrap the output that way; decoding ignores those line breaks, so the value still round-trips.

What is a data URI?

A data URI embeds the file in the value itself, as data:<mime>;base64,<characters>. It is handy for small images in CSS or HTML. When a file is loaded, turn on Include data URI to output one.

Can I turn Base64 back into a file?

Yes. Once the input decodes successfully, use Download decoded file to save the bytes as decoded.bin.

What does Live mode do?

With Live on, the tool converts text input about 200 ms after your last keystroke. In Auto mode it also follows the detected direction. Turn it off to convert only when you choose Convert.

Does it handle emoji and non-English text?

Yes. Encoding and decoding use UTF-8, so text such as 'Halo dunia', こんにちは, 你好, and 😀 round-trips correctly.

What happens if I paste invalid Base64?

In Decode mode the tool shows an error instead of returning corrupted text. It also rejects Base64 whose bytes are not valid UTF-8 text, so you never get a garbled result.

Is my text or file uploaded to a server?

No. Encoding and decoding run in your browser, and nothing you paste or drop is sent anywhere.

What is the difference between encoding and decoding?

Encoding turns text or bytes into Base64. Decoding reverses that and turns Base64 back into readable text. If you are not sure which you need, use Auto mode.