Image or file to Base64
Encode images or any other file as Base64 or as a data: URI to paste into HTML, CSS or JSON.
Process locally
Files stay in this browser session. Closing or clearing releases them.
Choose files
Any file, up to 10
Drop files here, or
Adjust settings
Optional: Add the data:…;base64, prefix, Line length
Run
Processes in this browser; cancel at any time
About this tool
Convert an image or any other file to Base64. Use it to embed a small icon in HTML or CSS as a data: URI, to put a picture into a JSON request that expects Base64, or to store a file in a config that only takes text.
Any file type works, up to 10 files and 10 MB in total. By default the result starts with a data: prefix whose type is detected from the file's content or name. Everything runs in your browser, and the files are not uploaded.
How to use it
- Choose up to 10 files of any type, or drop them on the page. You can also select Use example to try a sample image.
- Leave “Add the data:…;base64, prefix” on for HTML and CSS, or turn it off to get plain Base64. Set “Line length” to “One line”, “64 (PEM)” or “76 (MIME)”.
- Select Run.
- Preview the beginning of the result, then download base64.txt for the full text.
Formats and limits
- Input
- Any file, up to 10 files
- Output
- Plain text
- Size limit
- 10 MB in total
- Settings
- Add the data:…;base64, prefix; Line length (One line, 64, 76)
- Privacy
- Files stay in the current browser session. No file bytes are uploaded.
- Price
- Free, no sign-up
Common questions
Why is the Base64 cut off in the preview?
The preview shows only the first 20,000 characters, and Base64 is about a third larger than the original, so any file over about 15 KB fills it. Download base64.txt to get the complete text.
Can I convert files other than images?
Yes. Any file type works, for example PDF, font or ZIP files. The type in the data: prefix comes from the file's content when it is recognized, and from the file's name otherwise.
What happens when I convert several files?
All results go into one base64.txt. Each file's Base64 comes after a line with # and the file name, and a blank line separates the files.
When should I break the Base64 into lines?
Keep “One line” when you paste into CSS or JSON, where a string cannot contain line breaks. “64 (PEM)” and “76 (MIME)” split the text into lines of that length, as used in PEM files and email attachments.
How do I turn Base64 back into a file?
Use the “Base64 to image or file” tool. It accepts plain Base64 or a data: URI.
Related tools
Base64 to image or file
Turn Base64 or a data: URI back into a file such as an image; the type comes from the content or the URI.
Base16/32/58/64/85/91 encoding
Encode or decode Base16, Base32, Base58, Base62, Base64, Ascii85, Z85 and basE91, choosing the character set of the text, or hex for raw bytes.
Encode and decode text
Encode or decode Base64, Base64URL, URL, hexadecimal or HTML entities. Encoding is not encryption.
Character set encoding and mojibake repair
Show the bytes of text in UTF-8, GBK, GB18030, Big5, Shift_JIS and more as hex, turn hex back into text, or repair mojibake from text read in the wrong character set.
Unicode, HTML, URL and Punycode escapes
Convert text to and from \u escapes, HTML numeric entities, percent-encoding in any character set (such as GBK URLs), Quoted-Printable and Punycode domains.
File to hex
Show any file as hex: a hexdump with offsets and an ASCII preview, plain hex, or a C byte array.