Base64 Encode/Decode

Encode text to Base64 or decode Base64 back to text

Encode text as Base64 (standard or URL-safe) or decode Base64 back to text. Decoding also recognises images, PDFs and other files hidden in Base64 and previews images.
Try an example:

Output will appear here...

About Base64 Encode/Decode

How it works

  1. Encode: your text is converted to UTF-8 bytes, then every 3 bytes (24 bits) are split into four 6-bit groups, each written as one of 64 characters (A-Z, a-z, 0-9, + and /). "=" pads the end.
  2. Decode: the reverse - each Base64 character is turned back into 6 bits, and the bytes are read as UTF-8 text.
  3. If the decoded bytes are not text, we identify the file type from its first bytes (PNG, JPEG, PDF, ZIP…) and show images as a preview.

What you need

  • To encode: any text, including emoji and accented characters.
  • To decode: Base64 text. Spaces and line breaks are ignored, missing "=" padding is added, and URL-safe Base64 and data: URLs are accepted.

Tips

  • Base64 makes data about 33% larger - it is for transporting bytes safely through text-only channels, not for saving space.
  • Use URL-safe output for tokens in URLs and filenames (JWTs use it).
  • Wrap at 76 characters when pasting into email (MIME) messages.

Limitations

  • Base64 is encoding, not encryption: anyone can decode it. Never use it to hide passwords or secrets.

Runs in your browser. Everything happens in your browser - the text you enter is never uploaded.

Frequently asked questions

What is Base64 used for?+

Sending binary data (images, files, keys) through systems that only handle text: email attachments, data: URLs in HTML/CSS, JSON APIs, JWT tokens and basic HTTP authentication headers.

Is Base64 secure?+

No. It is a reversible encoding with no key - anyone can decode it instantly. Use real encryption to protect data.

Why does my output end with "=" or "=="?+

Base64 works in blocks of 3 bytes. When the input length is not a multiple of 3, "=" padding fills the last block so the output length is a multiple of 4.