Base64

Encode and decode Base64 text, files and images.

Runs in your browser. Nothing is uploaded.

Updated

Base64Runs in your browser
Your text stays on this device. No upload required.

How to use Base64

  1. Choose Text or File.
  2. Encode, or paste Base64 and decode.
  3. Copy the result or download the file.

Base64 at a glance

Typical use: Turn an icon into a CSS data URL, or a Base64 string back into an image.

Runs in your browser; nothing is uploaded.

What Base64 is for

Base64 writes any data, including images and other binary files, using only 64 plain characters (A–Z, a–z, 0–9, + and /), so it survives places that only accept text: e-mail attachments, JSON, HTML and CSS data URLs, HTTP headers, and keys and certificates in PEM files.

It is an encoding, not encryption: anyone can decode it. The result is about a third larger than the original (every 3 bytes become 4 characters).

Variants

  • URL-safe (RFC 4648 §5) uses - and _ instead of + and /, so the text can go in a URL or a file name. JWTs use it, without padding.
  • Padding: one or two = at the end make the length a multiple of 4. Some systems leave it out; this page decodes both.
  • Line length: e-mail (MIME) breaks lines at 76 characters, PEM keys at 64.

Base64 example

To put a small icon straight into CSS, open the File tab, choose icon.png, tick “As a data: URL” and copy the result into background-image: url(data:image/png;base64,…). Pasting a Base64 string in the Text tab and choosing Decode shows the text, a preview of an image, or a file to download.

Prefer the terminal?

The same in a terminal:

printf '%s' 'Hello, World!' | base64

Decode with base64 --decode. GNU base64 wraps at 76 characters (add -w 0 for one line); use printf, not echo, or a line break is encoded too. For a file: base64 < photo.png > photo.txt.

References

Frequently asked questions

Is my text or file uploaded?

No. Encoding and decoding happen in your browser; nothing is sent to our server.

Is Base64 encryption?

No. It only changes how data is written; anyone can decode it. Use encryption (for example Protect PDF, or a password-protected ZIP) to keep something secret.

Why does my decoded text look like rubbish?

The data may not be text (an image or a ZIP file, for example), or it was text in another encoding than UTF-8. The page offers non-text data as a file to download.

Why is the result different from my terminal’s?

Usually echo added a line break before encoding (use printf ’%s’), or the terminal wrapped lines at 76 characters. Both decode to the same data apart from that line break.