Image to Base64 Converter
Convert an image to a Base64 string or data URL, ready to paste into HTML, CSS, Markdown or JSON.
Runs in your browser. What you enter is kept for 30 days to improve Toolgrid, then deleted.
How to use the Image to Base64 Converter
- 1 Choose the image you want to encode.
- 2 Pick the output: data URL, plain Base64, CSS, HTML or Markdown.
- 3 Copy the result or download it as a text file.
About the Image to Base64 Converter
Base64 encodes binary data, such as an image, as plain text. A data URL (data:image/png;base64,…) lets you put an image directly inside an HTML page, a CSS file, an e-mail template or a JSON document, without a separate file.
Embedding saves an extra request for very small images like icons, but Base64 is about 33% larger than the original file and the browser cannot cache it separately. Use it for small images only, typically under a few kilobytes.
The CSS option gives a ready-to-use background-image rule; the HTML option an <img> tag with the width and height filled in.
Frequently asked questions
Why is the Base64 bigger than the image?
Base64 uses 4 text characters for every 3 bytes, so it is about 33% larger.
When should I use a data URL?
For small icons and images in e-mails or single-file pages. For larger images a normal file is faster and can be cached.
What is the difference between Base64 and a data URL?
A data URL is the Base64 text with a prefix that says what type of file it is, such as data:image/png;base64,.
Which image types are supported?
Any image file, including PNG, JPG, GIF, WebP, SVG and ICO.