Base64 File Converter

Convert any file to a Base64 string and back again in your browser. Drag in an image, PDF or other file to get its Base64 or Data URL, or paste Base64 to decode and download the original file.

FreeOnline Tool
Loading…

How to Use

  1. Click the upload area or drag a file onto it (images, PDFs and any other file type are accepted).
  2. The tool converts the file to a Base64 string and shows it in the output box.
  3. Click "Copy Base64" to copy the result.
  4. To go the other way, paste a Base64 string into the input box and click "Download file" to restore the original file.

Features

  • Encodes files of any format into a Base64 string
  • Decodes a Base64 string back into a downloadable file
  • Can produce Data URL format (data:image/png;base64,...)
  • Files are processed locally in your browser and never uploaded to a server
  • Drag-and-drop upload for quick handling

Use Cases

Inlining small icons in CSS
Convert a small image such as a logo or favicon into a Base64 Data URL and embed it in CSS to save an HTTP request.
Debugging file uploads over an API
Encode a file as Base64 to send it through a JSON endpoint while testing a Base64-based upload interface.
Encoding email attachments
Convert an attachment to Base64 for embedding in MIME email content so binary files survive text-only mail protocols.
Verifying a Data URL image
Decode a Base64 image string back to a downloadable file to confirm the picture inside a Data URL is the one you expect.

FAQ

Does Base64 encoding change the file size?
Yes, it grows by roughly 33%. Base64 encodes every 3 bytes of binary data as 4 characters, so the encoded text is about 4/3 the size of the original file.
When would I need a file as Base64?
Common cases include embedding images in HTML or CSS as Data URLs, sending binary files through JSON APIs, attaching files in email, and storing files in database columns that only accept text.
Is there a file size limit?
Browser memory is the limit, so keep files under about 10MB. Larger files take noticeably longer and the resulting Base64 string consumes a lot of memory.
What is the difference between a Data URL and plain Base64?
A Data URL carries a MIME type prefix such as data:image/png;base64, so it can be used directly as the src of an HTML img tag. Plain Base64 is only the encoded payload, with no type information.