File to Base64 converter

Choose any file to get its Base64 text as a data URI, plain Base64 or MIME-style 76-character lines. Or paste Base64 to rebuild the file and download it. The file never leaves your device.

File to Base64

Everything happens in your browser. Your files are never uploaded.

Base64 to file

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. To encode, choose or drop a file. The tool shows the original size, the length of the Base64 text and the overhead.
  2. Pick Data URI, Raw Base64 or MIME lines and press Copy, or save the text as a .txt file.
  3. To decode, paste Base64 or a data URI into the lower box. The detected type and size appear.
  4. Enter a file name if you want one (the default uses the type from a data URI, or .bin) and press Download file.

How it works

Base64 turns each group of 3 bytes into 4 characters from a 64-letter alphabet and pads the end with = when the last group is short, so the length is 4 × ⌈bytes ÷ 3⌉. A 3-byte file gives 4 characters; a 1,000-byte file gives 4 × 334 = 1,336. A data URI is data:<type>;base64, followed by that text.

Tips

  • For pictures only, the image to Base64 converter adds a CSS and img-tag output and a preview.
  • Base64 is encoding, not encryption: anyone can decode it.
  • Large files are better served as normal files; embedding them as Base64 makes pages heavy and uncacheable.

Frequently asked questions

Why is the Base64 text bigger than the file?

Base64 writes every 3 bytes as 4 characters, so the text is about one third longer than the file. A 1,000-byte file becomes 1,336 characters once padding is counted. The MIME format adds a line break after every 76 characters on top of that.

What is the difference between raw Base64 and a data URI?

Raw Base64 is only the encoded data, which is what most APIs and JSON fields expect. A data URI adds a prefix such as data:application/pdf;base64, so that it can be used where a web address is expected, for example in an img src or a link.

Can I paste Base64 without the data: prefix?

Yes. Plain Base64, URL-safe Base64 (with - and _), missing padding and line breaks are all accepted. Without a prefix the file type is unknown, so give the download a name with the right extension.

Is there a size limit?

Files up to 20 MB can be encoded, because the whole text must fit in memory and on the clipboard. Only the first part of a long result is displayed, but Copy and Save use the full text.

Is my file uploaded anywhere?

No. The file is read and encoded by your browser. Decoding also happens locally.

More in Developer

All tools in this category: Developer ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.