JPEG Compressor
Shrink JPEG photos with a quality slider you can see.
Turn an image into a Base64 data URI ready to paste into CSS or HTML.
Drop an image here, or click to choose one
PNG · JPEG · WebP · SVG · GIF — encoded in your browser
Image to Base64 turns an image into a data URI you can paste straight into HTML or CSS, removing one network request. It outputs the encoded string in three ready-to-use forms: raw Base64, a complete img tag and a CSS background-image rule.
A data URI embeds an image directly inside your HTML or CSS instead of pointing at a separate file. That removes one network request, which is worth doing for small assets such as icons, spinners and email signatures.
Drop in an image and the tool produces the encoded string in three ready-to-use forms: the raw Base64, a complete HTML img tag, and a CSS background-image rule. Bear in mind that Base64 inflates the data by roughly 33 percent, so this is a technique for small files. Anything over a few kilobytes is better served as a normal cached image file.
Raw Base64, a complete HTML img tag and a CSS background-image declaration, each ready to paste.
Embedding a small asset inline removes a round trip, which is worth doing for icons and spinners.
Base64 inflates data by roughly 33 percent, so the tool is clear that anything over a few kilobytes is better served as a cached file.
PNG, JPEG, WebP, GIF and SVG all encode, with the correct MIME type written into the data URI.
The file is read and encoded locally by your browser.
Drop in or select any image file, including SVG.
Switch between the raw Base64 string, an HTML img tag and a CSS background rule.
Copy the generated code straight into your stylesheet or markup.
For small, always-needed assets such as icons and logos under about 5 KB, where saving a request outweighs the size penalty. For photographs and large graphics, a normal image file is faster because it can be cached separately.
Base64 represents three bytes with four characters, adding about 33 percent, plus a small header. That overhead is inherent to the encoding.
Yes. SVG files encode fine, though for SVG you can often inline the markup directly, which is smaller and lets CSS style the shapes.
What people who use the Image to Base64 think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the Image to Base64. It takes half a minute and no account.
Write the first reviewShrink JPEG photos with a quality slider you can see.
Create soft multi-colour mesh gradient backgrounds.
Read the camera, lens, settings and GPS inside a photo.
Add RGB shift, scan lines and datamosh artefacts.
Place a logo in any corner at a size that scales.
Give a photo a warm, aged sepia tone.
Make a multi-size .ico file from any image.
Generate image markup that loads late and never shifts layout.