Compress

Compress JPGCompress PNGCompress WebPCompress AVIFCompress to 100 KBCompress to 200 KBCompress to 500 KB

Convert

Convert to JPGConvert to PNGConvert to WebPConvert to AVIFWebP to JPGPNG to JPGJPG to PNGWebP to PNG

Image tools

Crop ImageResize ImageImage to PDFImage to Base64

More tools

AI Prompt GeneratorColor PickerTime Zone ConverterQR Code GeneratorWord CounterPassword Generator

Image to Base64 Converter
Encode and Decode, Privately

Turn an image into a Base64 string or data URI for HTML, CSS and Markdown, or decode a Base64 string back into an image.

Data URI, HTML, CSS, MarkdownDecode Base64 to imageNo upload

Image → Base64

Drop an image to encode

or click to browse · any image up to 20 MB · or paste

Base64 → Image

How it works

01

Add an image

Drag and drop, browse or paste an image up to 20 MB.

02

Choose a format

Pick data URI, Base64 only, HTML, CSS or Markdown and click Copy.

03

Or decode

Paste a Base64 string in the second box to preview and download the image.

What is Base64 for images?

Base64 represents binary data such as an image as plain text. A data URI such as data:image/png;base64,… lets you put a small image directly inside HTML, CSS, JSON or an email, without a separate file or request.

When to use it, and when not to

  • Good for: tiny icons, placeholders and images in a single-file page or email template.
  • Avoid for: large images. Base64 is about 33% larger than the file, cannot be cached separately and bloats your HTML or CSS. Use normal image files for photos.

To keep it small, compress or resize the image first.

Decoding Base64 back to an image

Paste the string with or without the data:image/…;base64, prefix. The tool recognises PNG, JPG, GIF, WebP and SVG, shows a preview and lets you download the file. Invalid strings are reported instead of failing silently.

When developers use Base64 images

Developers use Base64 data URIs for tiny icons in CSS, self-contained HTML reports, email templates, API payloads and prototypes. This tool outputs ready-to-paste snippets for HTML, CSS and Markdown, and decodes Base64 strings back to images for inspection. Before embedding, shrink the image with the PNG compressor or resizer because Base64 adds about 33%.

Related reading

Learn when inline images help or hurt in Base64 images and data URIs, and how loading affects speed in Core Web Vitals image optimisation.

Frequently asked questions

Drop the image into the tool and copy the output. Choose a data URI if you want to paste it into HTML or CSS.
No. Base64 is only an encoding. Anyone can decode it, so it does not protect an image.
Base64 expands data by about 33%.
Yes. Paste it into the decoder to preview and download the file.
No. Encoding and decoding happen in your browser.
Any image your browser can read for encoding. The decoder recognises PNG, JPG, GIF, WebP and SVG.
Copy the data URI and paste it into the src attribute of an img element, for example <img src="data:image/png;base64,…">.
This tool accepts images up to 20 MB, but Base64 is best for very small images because it makes data about one third larger and cannot be cached separately.