File to Base64 Converter

Convert any file - images, PDFs, text and more - into a Base64 (data URI) string and copy or download it with one click. Or paste a Base64 string or data URI to restore and save the original file. Everything runs in your browser - your files are never uploaded.

Last updated: 2026/10/16 Developer Feedback & bug reports

Drag & drop

or

Any file: image, PDF, text, audio, ZIP and more (max 25MB)

How to Use

1

Choose a direction

Use "File → Base64" to encode a file into a data URI, or "Base64 → File" to restore a data URI back into a file.

2

Provide a file or Base64

Drag & drop or select a file to encode. To decode, paste the Base64 or data URI string into the text box.

3

Copy or save the result

Copy the data URI or Base64 string in one click. Restored files download directly with auto MIME detection.

About the File to Base64 Converter

An online tool that encodes any kind of file - images, PDFs, text, audio, ZIP and more - into a Base64 "data URI" string. A data URI lets you embed a file directly into HTML, CSS or JSON so you can carry data without referencing an external file. You can also paste a received Base64 string or data URI to restore and save the original file. The MIME type is detected automatically from the data signature, or you can set it manually. All processing happens entirely in your browser (JavaScript), so your files are never sent to any server.

Features

  • Any file typeNot just images - convert PDFs, text, audio, ZIP and any other file format.
  • Two-way conversionEncode files to Base64 and decode Base64 back to files - both in one tool.
  • Auto MIME detectionDetects the MIME type from the data URI or file signature, with manual override.
  • Browser-only processingEverything runs locally in your browser. Your files are never uploaded to a server.

Use Cases

  • Embed a file inside a JSON or YAML config
  • Save a PDF or file received as a data URI
  • Inline files in HTML emails or web fonts
  • Restore Base64 data from an API response into a real file
  • Reduce HTTP requests by embedding small files

FAQ

Are my files uploaded to a server?
No. All conversion happens locally in your browser (JavaScript). Your files are never sent to or stored on any server.
What kinds of files can I convert?
Any file format - images, PDFs, text, CSV, audio, video, ZIP and more. You can convert files up to 25MB.
What is the difference between a data URI and a Base64 string?
A Base64 string is binary data encoded as text. A data URI adds a "data:MIMEtype;base64," prefix so it can be embedded directly in HTML or CSS. This tool outputs both.
Does Base64 change the file size?
Base64 encoding increases the data size by about 33%. It is therefore best suited to small files rather than large ones.
Do I need a MIME type to decode Base64 back to a file?
A string with the "data:...;base64," prefix works as-is. For a raw Base64 string, the tool detects the format from the data signature. You can also set the MIME type and file name manually.
Does it work on smartphones?
Yes. It works in any browser on smartphones, tablets, and PCs.