FileTools

Base64 Encoder & Decoder

Encode and decode Base64 text and files instantly, in your browser.

Encode a file to Base64

Choose file

Any file type · processed in your browser

How to encode or decode Base64

To encode text: choose Encode, type or paste your text, and the Base64 result appears instantly.

To decode Base64: choose Decode and paste the Base64 string. You can also paste a full data: URL — the prefix is removed automatically. If the result is readable text, it’s shown directly; if it’s an image or other file, you’ll see a preview (for images) and a Download file button.

To encode a file: in Encode mode, scroll to Encode a file to Base64, choose any file up to 20 MB, and copy the result — optionally as a ready-to-use data: URL.

Common uses

How Base64 works

Base64 takes the input bytes three at a time (24 bits) and splits them into four groups of 6 bits. Each 6-bit value (0–63) is mapped to one of 64 characters. If the input length isn’t a multiple of three, the output is padded with =.

Because 3 bytes become 4 characters, Base64 output is about 33% larger than the original data. That’s why embedding large images as data URLs is usually a bad idea for performance — it works best for small icons and assets.

Standard vs URL-safe

Variant Characters 62 and 63 Padding Used in
Standard + and / = Email, data URLs, most APIs
URL-safe - and _ Usually omitted JWT, URLs, file names

The decoder accepts both variants automatically, and also tolerates missing padding, spaces and line breaks — common when copying Base64 from emails or logs.

Base64 is not encryption

It’s worth repeating: Base64 hides nothing. It only changes how data is written so it can travel safely through systems that expect text. Anyone can decode it in a second. To protect secrets, use real encryption, and treat Base64-encoded credentials (for example in basic auth headers) with the same care as plain text.

Troubleshooting

Image to Base64 (data URLs)

To embed a small image directly in HTML or CSS, encode the image file with As data: URL enabled and copy the result. You can then use it like this:

This saves a separate network request, which can help for tiny icons. For anything larger than a few kilobytes, a normal image file is better: it can be cached separately and doesn’t bloat your HTML or CSS by a third. Inline images also can’t be lazy-loaded or shared between pages, so reserve data URLs for small icons, placeholders and email templates where external images may be blocked. As a rough guide, keep inline images under about 4 KB, and switch to a regular image file for anything larger than that.

Private and local

All encoding and decoding runs in your browser — useful when you’re working with tokens, credentials or private files that shouldn’t be pasted into a website that sends them to a server. To pretty-print decoded JSON, use the JSON Formatter.

Frequently asked questions

What is Base64?

Base64 is a way to represent any data — text, images, files — using only 64 safe characters (A–Z, a–z, 0–9, + and /). It's used to embed binary data in text formats such as email, JSON, HTML and CSS.

Is Base64 encryption?

No. Base64 is an encoding, not encryption. Anyone can decode it instantly, so never use it to protect passwords or secrets.

Does it support emoji and non-English text?

Yes. Text is encoded as UTF-8 before Base64 encoding, so all languages and emoji round-trip correctly.

What is URL-safe Base64?

A variant that replaces + with - and / with _ and drops the trailing = padding, so the result can be used in URLs and file names. It's used in JWT tokens, for example.

Are my files or text uploaded?

No. Encoding and decoding happen in your browser and nothing is sent anywhere.

Related tools