Skip to content
Filemint

Convert an image to Base64

Get a ready-to-paste data URI, CSS background or HTML image tag from any picture.

  • No upload
  • No sign-up
  • No watermark
  • Free

How to convert an image to Base64

  1. Step 1

    Add an image

    Drop a PNG, JPG, WebP, SVG or GIF file into the box.

  2. Step 2

    Pick a format

    Choose the data URI, raw Base64, a CSS background rule or an HTML img tag.

  3. Step 3

    Copy it

    Press Copy next to the snippet you need and paste it into your code.

Four ready snippets

Data URI, raw Base64, CSS background and HTML img tag — each with its own copy button.

Size shown upfront

See how large the encoded string is before you paste it into a stylesheet or email.

Nothing uploaded

Encoding happens in your browser, so private assets and unreleased designs stay on your device.

What Base64 does

Base64 turns binary data — like an image — into plain text using 64 safe characters. Wrapped in a data URI, that text can live directly inside HTML, CSS, JSON or an email, with no separate file to host or request.

The catch is size: Base64 text is about a third larger than the original file. Filemint shows the encoded size so you can decide whether inlining is worth it.

Base64 isn't encryption or compression: anyone can decode it, and it doesn't make files smaller. It's simply a way to carry binary data through systems built for text.

When to inline an image

  • Good fits: small icons, simple logos, tiny background patterns and placeholder images.
  • Email templates: inline images can display without loading external files, though support varies between email clients.
  • Single-file demos: prototypes and HTML files you want to share as one document.
  • Poor fits: photos and large images, which bloat your code and can't be cached separately by the browser.

A useful rule of thumb: if the image is only a few kilobytes and appears on most pages, inlining saves a request. If it's large or used once, keep it as a normal file.

In CSS, an inlined image arrives together with the stylesheet, so there's no flash of a missing icon while a separate file loads.

Snippets you can paste

Each snippet is ready to use. The data URI starts with the right type, like data:image/png;base64, so browsers know how to read it. The CSS version wraps it in a background-image rule; the HTML version in an img tag. SVGs are encoded too — handy for icons in stylesheets.

Raw Base64, without the prefix, is what many APIs and JSON fields expect. Copy that version when a system asks for the encoded data on its own.

Remember to give an img tag meaningful alt text before publishing, so the image stays accessible.

Keep strings short

Shrink images before encoding to keep strings manageable: Resize Image to the size you'll display, then Compress Image to trim the bytes. To turn a Base64 string back into a file, use Base64 to Image.

Everything runs in your browser, so nothing you encode is uploaded. It's free, with no sign-up.

Frequently asked questions

How do I convert an image to Base64?

Add the image and copy the format you need: data URI, raw Base64, CSS or HTML.

What is a data URI?

A data URI embeds a file directly in text. It starts with the file type, such as data:image/png;base64, followed by the encoded data.

Does Base64 make images bigger?

Yes, by about a third. Use it for small images and keep larger ones as separate files.

Can I convert SVG to Base64?

Yes. SVG files are encoded like any other image and can be used in CSS or HTML.

How do I use a Base64 image in CSS?

Copy the CSS snippet; it contains a background-image rule with the data URI ready to paste.

Is my image uploaded when I encode it?

No. Encoding happens in your browser, on your device.

All Image tools