Image ↔ Base64

Encode images to base64 data URLs for use in CSS/HTML, or decode base64 strings back to image files.

Runs in your browser
Input — plain text

How to Use the Image to Base64 Converter

  1. To encode: upload an image file (PNG, JPEG, SVG, or WebP) using the file picker.
  2. The Base64 data URL is generated instantly — copy it with one click for use in HTML, CSS, or JavaScript.
  3. To decode: paste a Base64 data URL string into the text area.
  4. The decoded image is previewed immediately — click Download to save it as a file.

About the Image to Base64 Converter

Base64 encoding converts binary image data into a text string that can be embedded directly in HTML, CSS, or JavaScript without a separate file request. Common use cases include embedding small icons in CSS (reducing HTTP requests), inlining SVG sprites, storing images in JSON APIs, and embedding images in email HTML. The decoder is equally useful — paste any data:image/... URL and download the original image. All encoding and decoding runs locally via the browser's FileReader API; no data is transmitted anywhere.

Frequently Asked Questions

What is a Base64 image?
A Base64 image is a text representation of an image file encoded using the Base64 algorithm. It takes the form of a data URL like data:image/png;base64,iVBORw0K... and can be used anywhere a regular image URL would be used in HTML or CSS.
When would I use a Base64 encoded image?
Base64 images are useful for embedding small icons directly in CSS to eliminate HTTP requests, inlining images in email HTML (which blocks external URLs), storing image data in JSON, and creating self-contained HTML files that include all assets.
Is there a size limit for Base64 conversion?
There is no hard limit from the tool itself, but Base64 encoding increases file size by approximately 33%. Very large images (several MB) will produce very long strings. For large images, a regular URL reference is more efficient than inlining.
Does this work for SVG files?
Yes. SVG files can be Base64 encoded like any other image format, producing a data:image/svg+xml;base64,... URL. Note that for SVGs, you can also use URL-encoded SVG (data:image/svg+xml,...) which produces shorter strings than Base64.