Image to Base64 Encoder & Base64 to Image Decoder

Convert an image into a Base64 string ready for HTML, CSS, JSON or email templates, or paste Base64 to preview and save the original image. Exact bytes, no re-compression.

100% free No upload No watermark Works on mobile

Drop an image to encode

JPG, PNG, WebP, GIF, SVG, ICO or AVIF · up to 10 MB · or paste with Ctrl + V

How to use the Image to Base64 converter

  1. Pick a directionUse “Image → Base64” to encode a file, or “Base64 → Image” to decode a string.
  2. Add your inputDrop or paste an image, or paste a Base64 string or full data URI into the box.
  3. Choose the outputSelect a data URI, raw Base64, an HTML tag, a CSS rule, Markdown or a JSON string.
  4. Copy or downloadCopy the code to your clipboard, save it as a .txt file, or download the decoded image.

Features

  • Ready-to-paste snippets

    Get a data URI, HTML img tag, CSS background, Markdown or JSON string in one click.

  • Base64 to image

    Paste any Base64 or data URI to preview it and download it with the right file extension.

  • Byte-exact encoding

    Files are encoded exactly as they are, with no re-compression or quality loss.

  • Format detection

    Recognises PNG, JPG, GIF, WebP, SVG, BMP, ICO and AVIF from the data itself.

  • Size insights

    See the original size, encoded length and the roughly 33% Base64 overhead before you embed.

  • Private

    Encoding and decoding run in your browser; your images and strings are never uploaded.

What is Base64 and when should you embed images with it?

Base64 is a way of writing binary data, such as the bytes of a PNG file, using only 64 safe text characters. Once an image is encoded, it can live directly inside HTML, CSS, JSON, XML or an email template as a data URI like data:image/png;base64,iVBORw0…. The browser decodes it on the fly, so the image appears without a separate network request.

Good reasons to use Base64 images

  • Small icons and logos in CSS or HTML, where saving a request matters more than a few extra bytes.
  • HTML email signatures and templates that must show images even when remote content is blocked.
  • Single-file demos, offline pages and code playgrounds where you cannot host files.
  • APIs and JSON payloads that need to send an image inside a text field.

When not to use it

Base64 makes data about 33% larger, and an inline image cannot be cached separately from the page or stylesheet that contains it. For photos and anything over roughly 10–20 KB, a normal image file is usually faster. If you must embed something larger, shrink it first with the Image Compressor or convert it to WebP with the Image Converter; SVG icons often encode smallest of all.

Decoding Base64 back to an image

Found a long data:image string in a web page, an API response or a database? Paste it into the decoder tab. The tool cleans up whitespace and line breaks, detects the real image type from the first bytes, shows a preview and lets you download the file with the correct extension. Developers in India and the US use it to debug uploads, inspect email templates and recover images from exported data, all without sending anything to a server. URL-safe Base64 and strings split across many lines are handled automatically.

Image to Base64 FAQ

Drop your image into the Image → Base64 tab. The Base64 data URI appears instantly; choose another output style if you need an HTML tag, CSS rule or raw string, then press Copy.

Open the Base64 → Image tab, paste the string or data URI and press Decode image. You will see a preview and can download the image with the correct file type.

Base64 uses four text characters for every three bytes of data, so encoded output is about 33% larger than the original file. That is normal.

No. The file’s bytes are encoded exactly as they are, so decoding the result gives back an identical file.

Images up to 10 MB can be encoded. Very large strings can make the page slow, and Base64 is best suited to small images anyway.

No. Both encoding and decoding happen locally in your browser.

Private by design. Your images are processed in your browser and never uploaded.