Skip to content
ToolMug

Base64 Encoder & Decoder

Convert text or any file to Base64, or decode Base64 back to readable text or the original file. Handles UTF-8 correctly, supports the URL-safe variant used in JWTs, and runs entirely in your browser.

Runs in your browser — nothing you enter is uploaded

How to use

  1. Choose Encode or Decode.
  2. To encode, type text or switch to File and pick any file — an image, PDF or font.
  3. Pick options such as URL-safe characters, padding or data URL output.
  4. Copy the result. When decoding binary data such as an image, download it as a file.

Options explained

URL-safe
Replaces + and / with - and _ (RFC 4648 §5), so the result can go in URLs and file names. JWTs use this form without padding.
Padding
Adds = at the end so the length is a multiple of 4. Some systems require it, others (like JWT) omit it. The decoder accepts both.
Wrap at 76 characters
Splits the output into lines of 76 characters, the format required in email (MIME) and PEM files.
Data URL
Produces data:image/png;base64,… which can be pasted straight into HTML or CSS as an image source.

Examples

Input Base64
hello aGVsbG8=
hello (URL-safe, no padding) aGVsbG8
你好 5L2g5aW9
bytes FB FF BF +/+/ (standard) or -_-_ (URL-safe)

Decoding a JWT payload

A JWT has three parts separated by dots. The middle part is URL-safe Base64 without padding — paste it into Decode to read the claims. Remember the signature is not checked here, so do not trust a token just because it decodes.

Frequently asked questions

Is Base64 encryption?

No. Base64 is an encoding that anyone can reverse — it just represents bytes using 64 printable characters. Never use it to hide passwords or secrets.

Why is the Base64 text longer than the original?

Every 3 bytes become 4 characters, so Base64 is about 33% larger, plus line breaks if wrapping is enabled.

Why does decoding show garbled text or an error about binary data?

The Base64 contains bytes that are not UTF-8 text — usually an image, a zip or encrypted data. Use "Download decoded file"; the tool detects common image types and names the file accordingly.

How do I embed an image in CSS or HTML?

Switch to File, tick "Output as data URL", choose the image and paste the result into src="…" or url(…). This is best for small icons; large images make pages slower.

Does it handle Chinese, emoji and other non-English text?

Yes. Text is converted to UTF-8 bytes before encoding, the same as btoa(unescape(encodeURIComponent(…))) or Python's base64.b64encode(s.encode()).

Privacy

This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.

Related tools