My Tool Studio
Developer Tools·3 min read

Base64 Encode and Decode Text Safely in UTF-8

Base64 turns bytes into a safe ASCII string for transport, and it shows up in webhook payloads, auth headers and config values. The Base64 Decode and Encode tool converts text in both directions in your browser, and a second tab handles files and images. It is UTF-8 safe, so accented letters, non-Latin scripts and emoji come back exactly as typed. Nothing is sent to a server.

Hello WorldSGVsbG8gV29ybGQ=Base64

Encoding and decoding text

One page, both directions.

Paste text on the left and click Encode, or paste a Base64 value and click Decode, then copy the result on the right. Tick Live mode and pick a direction to convert as you type, and use Swap to send the output back to the input. Try sample loads a line with an accented letter and an emoji so you can watch the UTF-8 handling. The character count under the output helps when a header or form field has a length limit.

Text is converted to UTF-8 bytes before encoding. Calling the browser's btoa function directly on such text throws an error, which is the problem this page avoids. If a decoded value shows odd characters, the bytes were probably saved in another character set. Pick one such as Windows-1252 or Shift_JIS in the Character set menu, or leave it on Auto-detect when decoding.

Forgiving decoding

Messy input still works.

Decode accepts both standard Base64 and the URL-safe base64url alphabet, adds missing = padding, ignores line breaks and strips a data: URI prefix. Invalid input gets a plain message that says what is wrong, such as an invalid character or a cut-off string.

A trailing = or == is normal. Base64 turns every 3 bytes into 4 characters, and padding fills the last group when the input length is not a multiple of 3. That is also why encoded data is about a third larger than the original.

For a list of values, such as a column copied from a spreadsheet, tick Each line separately. Every line is converted on its own, and a line that fails is named by its number while the rest still convert. Split output into 76-character lines gives the wrapped form that email (MIME) expects.

base64url for URLs and JWTs

A small but important variant.

Base64url swaps + for - and / for _ so the result is safe in URLs and file names, and it usually drops the = padding. JWTs use it. Tick URL-safe output (base64url) before you click Encode when the result goes into a URL or token. Decoding needs no setting.

Decoding is not decryption

Base64 hides nothing.

Base64 is a reversible encoding with no key. Anyone who has the string can decode it. Never rely on it to hide passwords, API keys or personal data.

This matters for Basic auth. Type username:password, click Encode and put the result after the word Basic. Anyone who sees that header can decode it, so only send it over HTTPS.

Files, images and JSON

When the data is not text.

If a string decodes to an image, PDF or ZIP, the Text tab says the data is binary rather than showing garbled output, and offers to open it in the File or image tab. There, the tool reads the first bytes to spot the file type, shows a preview for images, and lets you rename and download the file. The same tab turns any file up to 100 MB into Base64, as plain text, a data URI or a ready <img> tag. For image-only jobs, the Base64 to Image Converter and Image to Base64 Converter are also available.

One common case fits well: decoded text that turns out to be JSON, as it often is inside tokens and configs. Decode it here, then paste the result into the JSON Formatter to indent and read it.

Try it now

Open Base64 Decode and Encode

The tool is one click away. No sign up, no upload, no payment.

Open Base64 Decode and Encode