TFT

Base64 Encode and Decode Online

Encode any text or file to Base64 for safe data transmission, or decode Base64 strings to retrieve the original content. This tool is essential for web development, email attachments, and data storage.

How it works

Pick Encode or Decode, then type or paste into the input box. The result updates as you type, so there is no convert button. A character count for the input and output sits under the result, and each box has a Copy button.

Base64 represents binary data using 64 printable characters: A to Z, a to z, 0 to 9, plus + and /. Every three bytes become four characters, so the output is about a third larger than the input. When the input length is not a multiple of three, the output is padded with one or two = signs.

Text is converted to UTF-8 bytes before encoding, and decoded bytes are read back as UTF-8. That means accented letters, non-Latin scripts and emoji survive a round trip, which is where a bare btoa call in the browser console tends to fail. Everything runs in your browser. Nothing you type is sent to a server.

  • URL-safe Base64 (a checkbox shown in Encode mode) swaps + for -, / for _, and removes the trailing = padding. Use it for tokens, query strings and file names.
  • Upload reads a .txt, .json, .xml or .csv file as text, fills the input box and encodes it.
  • Decoding adds any missing padding for you, so a string that lost its = signs still decodes. If the string is not valid Base64, an error appears under the input.

When this is useful

HTTP Basic authentication sends username:password as Base64 in the Authorization header, so decoding a header you captured in a log or a browser network panel is a common job. Kubernetes secrets and many CI settings store values as Base64, and you often need to check what one really contains.

JSON and XML cannot carry raw binary, so APIs frequently pass small payloads as Base64 strings. Configuration files, email headers and data URIs use it too. If you only need to peek inside a JWT, its header and payload are URL-safe Base64 and can be pasted here segment by segment.

What to know and the limits

Base64 is an encoding, not encryption. Anyone can reverse it in a second, so do not use it to hide passwords or keys.

This tool works on text. It does not convert images, PDFs or other binary files, because uploads are read as text and binary content would be corrupted. For that, use a data URI converter. Decoded output is shown as UTF-8 text, so decoding something that is not text, such as a PNG, produces unreadable characters.

URL-safe decoding has one quirk. The checkbox is only visible in Encode mode, but its setting also applies when you switch to Decode. To decode a string that uses - and _, tick the box first and then switch modes. Standard Base64 with + and / decodes with the box unticked. The tool does not wrap lines at 76 characters the way MIME does, and it will not accept line breaks inside a string you want to decode.

Very large inputs are held in memory in the page, so expect slowdowns with several megabytes of text.

Frequently asked questions

Why does my encoded string end in =? Padding fills the last group to four characters. One = means the final group had two bytes, and == means it had one.

Why did decoding fail? The usual causes are stray spaces or line breaks, characters outside the Base64 alphabet, or a URL-safe string decoded with the URL-safe box unticked.

Is my data uploaded? No. Encoding and decoding happen locally in your browser.

What is the difference between Base64 and Base64URL? Only two characters and the padding. Base64URL uses - and _ so the value can sit in a URL or file name without escaping.