Image to Base64
Embedding small images as base64 data URLs saves an HTTP request and keeps a snippet, email template or single-file demo fully self-contained.
How to use
- Drop a PNG, JPG, WebP or GIF into the upload area.
- Choose a complete data URL or raw base64 output.
- Optionally wrap the output every 76 characters.
- Check the size comparison, then copy or download the text.
Frequently asked questions
What is the difference between the two output forms?
The complete data URL starts with data:image/png;base64, and can be pasted directly into an HTML src or CSS url(). Raw base64 is just the encoded bytes without the prefix, which is what most APIs and JSON payloads expect.
Why is the base64 text bigger than my file?
Base64 encodes every 3 bytes into 4 characters, so the text is about 33 percent larger than the binary file, plus the short data URL prefix. The result panel shows both sizes so you can decide with real numbers.
When should I inline images instead of linking them?
Inline data URLs suit small icons, avatars and snippets where saving a request matters. For larger photos a separate cached file is almost always better — the 33 percent inflation and uncachable text outweigh the saved request.
Why is there a file size limit?
Very large files turn into multi-megabyte text strings that inflate memory and can freeze the tab. The cap mirrors the site-wide image dimension convention and fails fast with a clear message instead of producing a sluggish result.
What is the 76-character line wrapping for?
The MIME standard (RFC 2045) wraps base64 at 76 characters, and some transport formats such as certain email headers or certificate files expect it. Keep it off for HTML, CSS and JSON, where newlines inside the URL are inconvenient.
Is my image uploaded?
No. The file is read locally with FileReader and encoded in your browser. Nothing is transmitted, and the generated text can be copied or downloaded immediately.
Related tools
About this tool
Embedding small images as base64 data URLs saves an HTTP request and keeps a snippet, email template or single-file demo fully self-contained. This tool converts any PNG, JPG, WebP or GIF into text right in your browser: choose a complete data URL ready to paste into HTML or CSS, or raw base64 for APIs and data schemas, with an optional 76-character line wrap that matches the MIME convention. The result panel also shows an honest size comparison — base64 encodes three bytes into four characters, so the text is typically about 33 percent larger than the original file, plus the data URL prefix. Seeing both numbers side by side makes it obvious whether inlining is worthwhile or whether serving the file normally is the better deal. Conversion is a local, instant read of the file bytes with FileReader: nothing is uploaded, no account is required, and a one-click copy plus a text download are provided. Very large files are rejected up front with a clear bilingual message, because multi-megabyte data URLs inflate memory and slow every page that loads them.