Image to Base64 Converter Online — Free Data URI Tool
Convert images to Base64 data URIs online for free. Generate CSS background-image and HTML img src code. No upload, runs in your browser, no signup.
拖放图片到此处,或点击选择文件
支持 PNG, JPEG, GIF, WebP, SVG 等格式,最大 5MB
Convert images to Base64 data URIs for inline embedding in HTML, CSS, or JSON. Reduces HTTP requests for small images.
How to use Image to Base64 Converter Online — Free Data URI Tool
- Upload or drag an image.
- The Base64 string is generated automatically.
- Copy the data URI for use in HTML img src or CSS url().
Features
- Converts JPG, PNG, GIF, WebP, and SVG to Base64.
- Outputs ready-to-use data URI format.
- Shows original and Base64 file sizes.
- No upload — processes in browser.
FAQ
When should I use Base64 images?
Base64 is best for small images (under 4KB) like icons, logos, or sprites. It eliminates an HTTP request. For larger images, Base64 increases size by ~33% and blocks rendering, so regular file loading is better.
Does Base64 increase file size?
Yes, Base64 encoding adds about 33% overhead (3 bytes become 4 characters). A 3KB image becomes a 4KB Base64 string. This trade-off is worth it only when the HTTP request savings outweigh the size increase.
Can I use Base64 images in CSS?
Yes: background-image: url(data:image/png;base64,iVBOR...). This works in all modern browsers. It's useful for small background patterns and icons in CSS sprites.