Convert a JPG image to a Base64-encoded string for embedding directly in HTML, CSS, JSON, or code. Choose from four output formats: raw Base64, data URI, a ready-to-paste HTML image tag, or a CSS background-image declaration.
Drag and drop a JPG/JPEG file here, or click to browse
Base64 is a way of representing binary data (like image bytes) as a plain-text string made up of characters from the ASCII alphabet. The resulting string can be embedded anywhere that accepts text, with no need for a separate image file or server request.
A Base64-encoded JPEG is about 33% larger than the original binary file, so it is best suited for small images like icons, logos, and inline thumbnails rather than large photographs.
| Format | Example | Use case |
|---|---|---|
| Raw Base64 | /9j/4AAQSkZJRgAB… | APIs, JSON payloads, custom code |
| Data URI | data:image/jpeg;base64,… | Embed directly in src or url() attributes |
| HTML img tag | <img src="data:…"> | Paste directly into HTML |
| CSS background | background-image: url(…); | Inline images in stylesheets |
Base64 encodes every 3 bytes of binary data as 4 ASCII characters, which increases the size by approximately 33%. This is the trade-off for being able to represent the image as plain text.
No — Base64 images are best for small assets (under ~10 KB) like icons, spinners, or data URI thumbnails. Large Base64 images bloat your HTML or CSS files and cannot be cached separately by the browser, making pages slower overall.
No. The encoding is done entirely in your browser using the FileReader API. Your image never leaves your device.
This website may contain affiliate links. If you click on an affiliate link and make a purchase, we may receive a small commission at no additional cost to you.