Skip to content
gohacks.dev
Web

Image to Base64 Converter

Convert an image to Base64 and get a data URI, a CSS background, an img tag or Markdown, with the size increase shown. The file never leaves the browser.

Free · No sign-up · Your inputs stay in your browser

Input

Convert an image to Base64

Output

Choose an image

Base64 makes a file about 33% bigger and it cannot be cached separately from the page that embeds it. Inline only small images, such as icons under a couple of kilobytes; serve the rest as files.

Runs in this browser. Nothing you paste is sent to a server.

When inlining pays

A data URI saves a request but costs about a third more bytes, cannot be cached on its own, and has to be downloaded again with every page or stylesheet that includes it. Over HTTP/2 and HTTP/3 extra requests are cheap, so inline only tiny images: a small icon, a placeholder, an image in an HTML email that must not load remote content.

SVG is different

For SVG, a URL-encoded data URI is smaller than Base64 and stays readable. The SVG to data URI tool on this site produces that form.

Share

Frequently asked questions

Is there a size limit for data URIs?
Browsers accept data URIs of several megabytes, but anything that large defeats the purpose. Keep inlined images to a few kilobytes.
Does the image get uploaded?
No. It is read by this page with the FileReader API and converted in your browser.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools