Back to All Tools

Base64 Encoder / Decoder

Encode and decode Base64 text — or drop a file and copy its Base64 representation. Everything stays in your browser.

Runs entirely in your browser — nothing is uploaded

About the Base64 Encoder / Decoder

Base64 turns arbitrary bytes into a text string built from 64 safe characters, so data that would break email headers, JSON fields, or URLs can travel as plain text. This tool does both directions. You paste text to encode it, paste a Base64 string to decode it back, or hand it a file to get the Base64 of that file's raw bytes. It solves the everyday problem of moving binary or non-ASCII data through channels that only accept text.

The text side has an Encode and a Decode mode you switch with two buttons. Encoding runs your input through encodeURIComponent first, so accented letters, emoji, and other multi-byte UTF-8 characters survive the round trip instead of getting mangled. Decoding strips whitespace and line breaks out of the string before converting, so pasted blocks that wrap still work. The file section reads the bytes directly and reports the name, size in KB, and character count.

Because encoding and decoding use the browser's own btoa and atob, it needs no account and never uploads what you paste. The encoding, decoding, and file reading all happen locally through the browser's own btoa, atob, and file APIs, so nothing you type or drop in is uploaded. That matters when the string is an API token, a config value, or a private document. Once the page has loaded you can use it offline, with no queue, watermark, or sign-in wall between you and the result.

How to use the Base64 Encoder / Decoder

  1. 1Pick Encode or Decode using the two mode buttons at the top of the panel.
  2. 2Type or paste your content into the Input box below the buttons.
  3. 3Click the Encode or Decode button and read the result in the Output box.
  4. 4Click Copy result to put the output on your clipboard, or Clear to empty both boxes.
  5. 5Use Swap to move the output into the input and flip the mode for a quick reverse check.
  6. 6To encode a file, choose it under File to Base64 and copy the string with Copy Base64.

What you can use it for

Inline an image in CSS

Drop a small icon or background PNG into the file box, copy its Base64, and paste it into a data URI in your stylesheet or HTML. The image ships inside the file itself, so the browser makes no separate request to fetch it.

Read a decoded token

When a config file or log holds a Base64 blob, switch to Decode and paste it to see the plain text underneath. Since decoding strips whitespace first, a value wrapped across several lines still converts cleanly.

Check UTF-8 handling

Paste text with accents or emoji, encode it, then hit Swap to decode the result back. If the original characters return unchanged, you have confirmed the multi-byte encoding is correct before committing the value to code.

How Base64 and its padding work

Base64 takes three bytes of input, which is 24 bits, and slices them into four groups of 6 bits. Each group maps to one character in the alphabet of A-Z, a-z, 0-9, plus, and slash. Because six bits hold exactly 64 values, every group has a matching character. The trade is size: three bytes become four characters, so encoded output is roughly 33 percent larger than the original.

The equals signs at the end are padding. Input does not always divide evenly into three-byte groups. One leftover byte produces two Base64 characters plus two equals signs; two leftover bytes produce three characters plus one equals sign. That padding tells a decoder how many real bytes the final group holds, which is why removing or corrupting it triggers the Invalid Base64 input error this tool reports.

Frequently asked questions

Does my pasted text or chosen file get uploaded when encoding?

No. The tool uses the browser's own btoa and atob for text and reads files in the page itself. All of it runs on your machine, so the string you paste and the file you choose never leave your browser. That is why it keeps working even after you lose your connection.

Why did decoding show an Invalid Base64 error?

Decoding only succeeds on a valid Base64 string. If characters outside the Base64 alphabet are present, or the padding is wrong, the tool reports Invalid Base64 input and leaves the output empty. Spaces and line breaks are removed before decoding, so wrapped text is fine, but a stray leading label is not.

Can I turn a Base64 string back into a file?

Not here. The file box goes one direction only: it takes a file and produces its Base64 text. To rebuild a file from Base64 you would decode it elsewhere. The text Decode mode gives you decoded text, not a downloadable binary file.

Does it handle emoji and non-English text?

Yes. Before encoding, the tool passes your input through encodeURIComponent so multi-byte UTF-8 characters are represented correctly. Accented letters, emoji, and non-Latin scripts encode and decode without corruption, which plain btoa alone cannot do because it only accepts characters in the Latin-1 range.

Is there a size limit on files?

The code sets no fixed cap, so the practical limit is your browser and memory. The whole file is read into memory and encoded at once, and Base64 output runs about a third larger than the original bytes. Very large files can make the tab slow, so keep files modest for a smooth result.