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
- Choose “File → Base64”, then drop a file above or click “choose files” (up to 50 MB).
- Pick an output format: plain Base64, a Data URI, or, for images, a ready-made HTML <img> tag or CSS background.
- Click “Copy” or “Download .txt” to grab the result.
- 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.
- 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.
Related tools
Base64 Encode/Decode
Encode text to Base64 or decode it back, with full UTF-8 support for Chinese and emoji and a URL-safe option.Image Converter
Convert images to JPG, PNG or WebP in bulk, with quality and a background color for transparent areas. Runs in your browser; nothing is uploaded.File Hash Checker
Compute MD5, SHA-1, SHA-256, SHA-512 and more for files of any size, and verify them against a published checksum.