Toolbox for developers / Base64 image encoder

Base64 image encoder

This tool allows you to encode image to base 64 string.

Just click on the "Browse image" button to upload your image, and it will be automatically encoded in base 64. You get your base 64 image, HTML code and CSS code to embed your image in a web page (it is up to you to see what is useful to you).


Select your image to convert
Base64 string
Image source for HTML
Image source for CSS


About base64

Base64 is a binary-to-text encoding scheme, it encodes binary data in plain text, Base64 represents binary data in an ASCII string format.

Base64 allows to transmit the data without loss or modification of the contents. It is useful for protocols that expect ASCII data.

Why to base64 encode images ?

Base64 encoding allows you to embed images right in your HTML, CSS, or JavaScript. Base64 encoded images become part of the html and displays without loading anything.

Base64 encoding images reduces the number of HTTP requests to download the webpage. With base64 encoding you save HTTP requests! When you need to load many small images, this increases the number of HTTP requests, in which case it may be interesting to convert the images to base 64. But it makes file sizes roughly 33% larger than their original binary representations.
With HTTP/2, this solution is less relevant, as the multiplexing decreases the impact of these HTTP requests.

You can also need to convert image to base64 for use in an API.

The tools are provided "as is", without warranty of any kind, either express or implied.