File to Base64
Drag & drop (or choose) any file — image, font, PDF, binary — and this tool reads its bytes and produces a Base64 string plus a data: URI with the MIME type, ready to paste into HTML/CSS. The file is processed entirely on your device.
Drag & drop a file here, or click to choose
Choose fileThe file is processed in your browser and never uploaded to a server.
Example
Example Input
logo.png (upload)
Example Output
iVBORw0KGgo… + data:image/png;base64,…
How to Use
- 1Drag & drop a file onto the upload area, or click to choose one.
- 2Click "Encode to Base64".
- 3Copy the raw Base64 string, or the ready-to-embed data: URI.
About File to Base64
File to Base64 turns a file’s raw bytes into Base64 text. Base64 represents binary data using 64 safe ASCII characters, so it can be embedded where only text is accepted — like HTML, CSS, JSON, or email.
Besides the raw Base64 string, the tool also builds a complete data: URI (data:<mime>;base64,<data>) you can use directly as an image src, @font-face source, or CSS background — embedding a resource with no separate file. Note: Base64 adds ~33% to the size, so it suits small assets best.
Unlike the text-based Base64 tool (which encodes text you type), this one takes an actual FILE via a browser upload. No bytes are sent to a server — everything runs locally with FileReader.
FAQ
Is my file uploaded to a server?
No. The file is read and encoded entirely in your browser with FileReader. No bytes leave your device — safe for sensitive files.
When should I use a data: URI?
For small assets (icons, small fonts, inline images) to reduce the number of network requests. For large files, linking a separate file is usually better since Base64 adds ~33% to the size.