Skip to content

Image to Base64 converter

Convert an image to a Base64 string or data URI, and decode Base64 back to a viewable image, entirely in your browser.

or drop one here PNG, JPEG, GIF, WebP, SVG and more. Nothing is uploaded.

How it works

Base64 turns binary image data into plain text so it can be embedded directly in HTML, CSS or JSON instead of linked as a separate file. A data URI adds a short prefix identifying the format, so a browser can render it without a separate request.

  1. Drop or choose an image

    PNG, JPEG, GIF, WebP, SVG and most other formats a browser can display.

  2. Pick data URI or raw Base64

    Use the data URI directly as an img src or CSS background-image; use raw Base64 when your own code adds the prefix.

  3. Copy, or switch to decode

    Paste a Base64 string or data URI on the other tab to preview and download it as an image.

When to use Base64 images

Inline Base64 images remove an HTTP request for small images like icons or logos, which can help in specific scenarios. Base64 encoding also inflates the data by about 33%, increases the size of the HTML, CSS or JSON file it sits in, bypasses the browser's normal image cache, and is harder to update than a linked file. Most sites should reserve it for small images, roughly 2 KB or less, used inline.

Nothing leaves your device

The image is read with the browser's File API and encoded entirely in JavaScript. No file data is transmitted to any server, which makes this safe for screenshots, design assets, or any other image you would rather not upload.

Frequently asked questions

How do I convert an image to a Base64 data URI for embedding in HTML or CSS?

Drag and drop an image onto the upload area, or click Choose an image to select a file. The tool reads the image locally, encodes it to Base64, and shows either a full data URI (data:image/png;base64,...) or raw Base64 depending on which output format you pick. Use the data URI directly in an img src attribute or a CSS background-image property.

Is my image uploaded to a server during Base64 conversion?

No. The image is read using the browser's File API and encoded entirely in JavaScript on your device. No file data is transmitted to any server. This makes the tool suitable for converting screenshots, design assets, icons, or any other image file without privacy concerns.

When should I use Base64-encoded images versus external image files?

Inline Base64 images eliminate an HTTP request for small images like icons, logos, or data-URI placeholders, which can reduce page load time in specific scenarios. However, Base64 encoding inflates image size by about 33%, increases HTML or CSS file sizes, bypasses browser image caching, and is harder to update. The general recommendation is to use Base64 only for very small images, under about 2 KB, used inline.

How do I decode a Base64 string back to a viewable image?

Switch to the Base64 to image tab, paste the Base64 string, with or without the data URI prefix, and click Decode to image. The tool decodes and renders a preview. You can then inspect the image or download it. If the string is truncated or corrupted, the preview fails to render and the tool tells you.

What image formats does this Base64 converter support?

The converter accepts any image format the browser can display, which typically includes PNG, JPEG, GIF, WebP, SVG, AVIF and ICO. The file picker filter is set to image/*, so non-image files are excluded by default. The output data URI includes the correct MIME type based on the detected file type.