Image to Base64 - Encode Images as Data URLs
Encode an image as Base64
Drop an image onto the page or click to choose one. You get three things to copy: the raw Base64 string, the full data URL
with its MIME type, and an <img> tag with the data URL and the file name as alt text. The file name, MIME
type, original size and Base64 size are shown above them. Any format your browser can open works, including PNG, JPEG,
WebP, GIF and SVG.
Using the output
In HTML, paste the img tag, or use the data URL as the src. In CSS:
.icon {
background-image: url("data:image/png;base64,iVBORw0KGgo...");
} For SVG icons, Base64 is not the smallest option. A URL-encoded SVG data URI is shorter and still readable; the SVG optimiser produces one after minifying the file. Shrink large images with the image compressor before encoding them.
Related Tools
SVG Optimiser
Optimise SVG files by removing unnecessary metadata and redundant attributes using SVGO.
Image Compressor
Compress images in your browser with adjustable quality and format selection.
Image Resizer
Resize images to any dimension with aspect ratio lock and common presets.
QR Code Generator
Generate QR codes for URLs, Wi-Fi, contacts, email, SMS, or phone with colours, logo, and PNG/SVG export.