Image to Base64 Online - Encode and Decode Images
Image ↔ Base64 conversion
Or drag an image into this area
About Image Base64 Conversion
Once converted to Base64, an image can be embedded directly in HTML/CSS to reduce HTTP requests. Base64 increases size by about 33%, so it suits small icons. To convert formats, use the image format converter.
Base64 Conversion Use Cases
Front-end performance: encode small icons as Data URIs embedded in HTML to cut HTTP requests; HTML emails: embed images in emails so recipients can see them offline; CSS backgrounds: write images directly into a stylesheet via background-image: url(data:...); API data transfer: convert images to Base64 strings and send them over JSON.
FAQ
Does Base64 encoding make the file larger?
Yes. Base64 increases size by about 33% because every 3 bytes become 4 characters. Use Base64 only for small icons (under 10KB); for large images a direct image link is better.
When is a Base64 image a good fit?
Embedding small icons in front-end code to cut HTTP requests; embedding images in emails so recipients can see them; encoding CSS background images as Data URIs to reduce resource dependencies.
What is the difference between the output formats?
The Data URI can be used directly in an img src attribute; CSS background can be pasted into a stylesheet; HTML img generates a complete img tag; Base64 only contains the encoded data without the prefix.
Does decoding auto-detect the image format?
Yes. If the pasted Base64 string has no data:image prefix, the tool detects JPG/PNG/GIF/WebP/BMP/SVG from the encoded header.