toolqik

80 · Encode & Convert

Base64 Image Encoder

Convert images to Base64 data URLs for HTML, CSS and JSON, or Base64 back to an image.

Runs in your browser

Base64 to image

About this tool

Turn an image into text you can paste straight into code. Choose, drop or paste an image, and get it as a Base64 data URL plus ready-made snippets for HTML <img>, a CSS background-image, Markdown and JSON. The second half of the page does the reverse: paste Base64 or a data: URL to preview the image and download it as a file.

What is a data URL?

A data URL embeds a file’s contents directly in a URL: data:image/png;base64,iVBORw0KGgo…. The browser displays it like any image link, without a separate request. The part after the comma is the image file encoded as Base64, which turns every 3 bytes into 4 text characters, so the result is about 33% larger than the original file.

When to inline images

  • Good: small icons and logos in HTML emails (many clients block external images but show inline ones), single-file HTML reports, CSS for small UI icons, JSON APIs that carry an avatar or thumbnail, and test fixtures.
  • Avoid for photos and large images: inlined data can’t be cached separately, delays the page while the HTML or CSS downloads, and grows by a third. A warning appears above 20 KB.
  • For SVG, the data URL works everywhere, though a URL-encoded SVG (not Base64) is often smaller in CSS.

Decoding Base64 to an image

Paste a full data URL or bare Base64. The format is detected from the file’s first bytes (PNG, JPEG, GIF, WebP, AVIF, BMP, ICO or SVG), not just the label, so mislabelled data still opens correctly. URL-safe Base64 and missing padding are handled. For Base64 that isn’t an image, use the Base64 encoder and decoder.

FAQ

How do I convert an image to Base64?

Choose, drop or paste an image. The Base64 data URL appears instantly, along with HTML, CSS, Markdown and JSON snippets you can copy.

How do I use a Base64 image in HTML?

Put the data URL in the src attribute: <img src="data:image/png;base64,…" alt="…">. The HTML tab gives you the complete tag, including width and height.

How do I use a Base64 image in CSS?

Use it as a URL: background-image: url("data:image/png;base64,…"). The CSS tab gives you the ready-made declaration.

Why is the Base64 bigger than my image?

Base64 represents every 3 bytes with 4 characters, so encoded data is about 33% larger than the original file.

How do I convert Base64 back to an image?

Paste the Base64 or data URL into “Base64 to image”. You will see a preview and can download the image file.

Is my image uploaded?

No. Images are read and converted in your browser.

esc
↑↓ navigate↵ open