Your files stay with you.
IMAGE→BASE64

Image to Base64

Drop an image to get its Base64 in the format you need: a data URI, raw Base64, a CSS background rule or an HTML img tag.

Your files stay with you. Nothing uploaded. Nothing saved.

Loading the converter…

How to use the Image to Base64 tool

  1. Drop an image onto the box or click to choose a file.
  2. Pick the output you need: data URI, raw Base64, CSS or HTML.
  3. Copy it straight into your code.

When to inline images as Base64

Embedding an image as a data URI puts the image inside your HTML, CSS or JSON instead of in a separate file. That saves a network request, which can help for tiny images such as icons, loading spinners and small logos, or when you need a single self-contained file like an HTML email or a report.

It’s a poor fit for larger images. Base64 makes data about 33% bigger, the image can’t be cached separately from the page, and it delays the page’s first render. A good rule is to inline only images under about 10 KB.

Which output to copy

  • Data URI: paste into an src or url().
  • Base64 only: for APIs and JSON fields that expect the raw string.
  • CSS background: a ready-made background-image rule.
  • HTML <img>: includes the width and height to prevent layout shifts.

To shrink the image before encoding it, run it through Compress Image first. To turn a Base64 string back into a file, use Base64 to Image.

Frequently asked questions

When should I inline an image as Base64?

For small icons and images under about 10 KB, inlining saves an HTTP request. Larger images are better served as normal files, because Base64 makes them about 33% bigger and they can’t be cached separately.

Can I convert files that aren’t images?

Yes. Any file works and you get its data URI and raw Base64. The CSS and HTML snippets are only useful for images.

Are my files uploaded to a server?

No. HushConverts converts everything with code that runs in your browser, so your text and files stay on your device. You can even use most tools offline once the page has loaded.

Related guides

More encoding & developer