Skip to main content
Tools

File to Base64

Convert images and any other file to Base64 or a Data URI, or turn Base64 back into a file to preview and download.

Drop files here, or

Any file type, up to 50 MB.

Files are never uploaded.

How to use

  1. Choose “File → Base64”, then drop a file above or click “choose files” (up to 50 MB).
  2. Pick an output format: plain Base64, a Data URI, or, for images, a ready-made HTML <img> tag or CSS background.
  3. Click “Copy” or “Download .txt” to grab the result.
  4. To turn Base64 back into a file, choose “Base64 → file” and paste Base64 or a Data URI, or open a text file that contains it.
  5. The tool works out the file type from the Data URI or the content, previews images, audio, video and text, and saves it when you click “Download file”.

FAQ

Are my files uploaded?

No. Files are read and converted inside your browser. Their contents never leave your device, and the tool works offline.

Why is the Base64 bigger than the file?

Base64 uses 4 characters for every 3 bytes, so it is about 33% larger. A Data URI adds the data:type;base64, prefix, and wrapping at 76 characters adds line breaks.

What is the difference between a Data URI and Base64?

A Data URI is “data:image/png;base64,” followed by the Base64. It names the file type, so it can go straight into an HTML src or a CSS url(). Choose plain Base64 when you only need the encoded data, for example in an API field, JSON or an email attachment.

My Base64 has no type. How does the tool know what file it is?

It reads the first bytes of the decoded data (the file signature) to recognize common formats such as PNG, JPEG, GIF, WebP, PDF, ZIP, MP3 and MP4, and suggests an extension. Unrecognized UTF-8 content is treated as text and anything else is saved as .bin; you can change the file name.

When should I embed an image as a Data URI?

For small icons of a few KB or images used once, it saves a network request. Large images make your HTML or CSS heavier and cannot be cached separately, which usually makes pages slower, so link to the file instead.

Keyboard shortcuts

/
Search tools (on a tool page, goes to the homepage search)
?
Show this help
Esc
Close a dialog
Ctrl / ⌘Enter
Run the tool's main action (where supported)

While you type in a text field, / and ? are typed as usual.