Image to Base64 Converter
Upload an image to get its Base64 encoded string and data URI for embedding in HTML, CSS, or JS.
Drag & drop an image here, or click to browse
Accepts JPG, PNG, WebP, GIF, SVG, BMP
Upload an image to get its Base64 encoded string and data URI for embedding in HTML, CSS, or JS.
Drag & drop an image here, or click to browse
Accepts JPG, PNG, WebP, GIF, SVG, BMP
Base64 encoding converts binary image data into a text string that can be embedded directly in HTML, CSS, or JavaScript. This eliminates additional HTTP requests when loading images, which can improve performance for small images like icons, logos, and UI elements.
Upload any image file and the tool reads it using the FileReader API to generate a Base64 encoded string. You get three outputs: the full data URI (with MIME type prefix), the raw Base64 string, and a ready-to-use HTML img tag. Click any copy button to copy the output to your clipboard.
Base64 encoding increases the data size by approximately 33%. For small images (under 10KB), the benefit of eliminating an HTTP request outweighs the size increase. For larger images, it is usually better to serve them as separate files. The tool displays the Base64 string length so you can make an informed decision about whether to embed the image inline or load it externally.