File to Base64
Select a file to encode it as Base64, as a plain string or as a data URI you can paste into HTML, CSS, JSON or an API request. Encoded in your browser.
- Runs in your browser
- Free to use
About this tool
Embedding a small image in CSS, sending a file through a JSON API or pasting a certificate into a config: all of them need the file as text. File to Base64 reads any file in your browser and returns the Base64 string or a complete data URI with the right MIME type, wrapped for display and copied intact with one click. Nothing leaves your device.
Decode with Base64 to Image, Base64 to PDF or Base64 Encode/Decode.
How to use it — quick steps
- 01
Add the file
Drop any file on the dashed area or choose it from your device; a new file replaces the previous one.
- 02
Pick the output
A plain Base64 string, or a data URI with the MIME type prefix for use in src and url() attributes.
- 03
Press "Convert to Base64"
The encoded text appears below the file with a [copy] action; it is wrapped on screen and copied intact.
Key features of this tool
Base64 or data URI
Plain Base64 for APIs and JSON, or a ready-made data URI for inline images, fonts and files in HTML and CSS.
Encoded on your device
The file is read with the File API and encoded in memory; nothing is uploaded or stored.
One-click copy
The whole file Base64 string is copied instantly in one click, no matter how long it is.
Frequently asked questions
What is a data URI?
A URL that embeds the file itself: data:image/png;base64,iVBOR… It can replace an external file in an img src, a CSS url() or a link, at the cost of being about 33% larger than the binary.
Why is there a size limit?
Base64 text is held in the page; 10 MB of file becomes about 13 MB of text, beyond which browsers and clipboards struggle.
How do I decode it back?
Use Base64 to Image, Base64 to PDF or Base64 Encode/Decode (depending on the content) to convert the Base64 string to a file.
Are my files or data uploaded?
No. The tool is plain JavaScript that runs in your browser; the files or data you provide here are never uploaded to our servers.