Image to Base64 Converter
Turn an image into Base64 code you can paste into HTML or CSS.
Upload an image to encode
Drop an image here
Ready for CSS
Use the code as a CSS background image, with no separate file to load.
Ready for HTML and JSON
Store small images as text, for example in JSON.
Embed images inline
Embed small images directly in HTML or CSS to save a request. Base64 text is about a third larger than the original file.
Image to Base64 FAQ
Why is Base64 larger than the image?
Base64 encoding maps 3 bytes of binary data into 4 ASCII characters. This results in an approximate 33.3% increase in size compared with the original file, so it suits small icons best.
Why use Base64?
An inline image needs no extra request, which can help for very small icons. For larger images a normal file is usually faster.
How to use the Image to Base64
- Choose or drop an image.
- Wait for the Base64 data URI to appear.
- Copy it into your HTML, CSS or JSON.
Questions and answers
Are my files uploaded to a server?
No. The file is read and processed in your browser, and the tool does not send it anywhere.
Why is the Base64 text larger than the image?
Base64 uses four characters for every three bytes, so the text is about a third larger than the file.
More free tools
Image Converter
Convert images between JPG, PNG and WebP.
Open toolImage Compressor
Shrink JPG, PNG and WebP images, or compress to a target size in KB.
Open toolColor Contrast Checker
Check the contrast ratio of a text and background colour, with pass or fail for WCAG 2.2 AA and AAA.
Open toolColor Picker
Pick a colour and copy its HEX, RGB and HSL codes.
Open toolNeed a custom tool or app for your business? See our web and software development and AI automation services.