Convert any image to a Base64-encoded data URL so you can embed it directly in HTML, CSS, or JavaScript without a separate file reference. Base64 images are useful for email templates, inline SVG styles, data URIs in stylesheets, and situations where you can't host files externally. The output is a text file containing the complete data URL string, ready to copy-paste.
Drop files here
or browse to upload · paste from clipboard
Up to 10.0 MB per file
Upload your image
Drop a JPEG, PNG, WebP, or AVIF image (max 10 MB — Base64 strings get large quickly). The tool reads the raw file bytes without re-encoding.
Click Convert
The image bytes are converted to a Base64 string and wrapped in a data URL with the appropriate MIME type prefix (e.g., data:image/jpeg;base64,...).
Download the text file
The output is a .txt file containing the complete data URL. Open it in any text editor, then copy the string.
Use in your code
Paste the data URL directly into an img src attribute, a CSS background-image property, or a JavaScript string. No separate image hosting needed.
A Base64 data URL is a way to embed binary data (like an image) directly in a text string. The format is: data:[mime-type];base64,[encoded-data]. It allows images to be used directly in HTML, CSS, and JavaScript without loading a separate file over the network. A JPEG image becomes a very long string starting with data:image/jpeg;base64,/9j/4AAQ...
Use Base64 when: you need to embed images in HTML email templates (where external URLs may be blocked), in single-file HTML documents, in SVG files, or in JavaScript-generated content. Avoid Base64 for large images on public websites — it increases HTML/CSS file size by ~33%, blocks parsing, and cannot be cached separately from the page.
Base64 encoding represents every 3 bytes of binary data as 4 ASCII characters — a 33% overhead. A 100 KB JPEG becomes a ~133 KB Base64 string. This is the fundamental trade-off of Base64: it makes binary data representable as text, but at a size cost. For large images, this overhead is significant.
We limit input to 10 MB. The resulting Base64 string will be ~13.3 MB. Browsers handle large strings fine, but embedding them in HTML/CSS can significantly slow page rendering. For web use, keep embedded images under 10–20 KB. Larger images should be served as separate files.
Yes: <img src="data:image/jpeg;base64,/9j/4AAQ..." alt="My image">. The browser decodes the Base64 string and displays the image without any network request. This works in all modern browsers for JPEG, PNG, GIF, WebP, and SVG formats.
Something not working? Report a bug