1. Home
  2. Image tools
  3. Image to Base64

Image to Base64

Embed small images straight into HTML, CSS or emails without separate files.

Free, no sign-up. Runs in your browser: nothing is uploaded.

Free workspace included. Docs, spreadsheets, notes and tasks that save on your device. No sign-up.Take a look

How to use Image to Base64

  1. Drop an image.
  2. Choose data URL, img tag or CSS.
  3. Copy the snippet.

Features

  • Data URL, HTML img, CSS and Markdown snippets
  • Decode Base64 back to an image
  • Encoded size shown
  • SVG supported

Supported formats

You can open

  • PNG
  • JPG
  • GIF
  • WebP
  • SVG
  • ICO

You get

  • Base64
  • Data URL

Private by design

Your files are opened and processed by your browser on this device. They are never uploaded to openWorkstand or anyone else, so the Image to Base64 is safe for contracts, IDs, photos and work documents. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Base64 makes a file about a third larger than the original, so embed only small images such as icons and logos.

Guide

When to inline an image as Base64, and when not to

A data URL puts an image directly inside your code, as text, instead of linking to a separate file: data:image/png;base64,iVBORw0KGgo…. It’s useful in a few specific situations and a performance problem in most others. This tool generates the snippets in both directions, and it helps to know when to use them.

Where inlining makes sense

  • Tiny icons and logos in CSS or HTML, where a separate file request would cost more than the extra bytes.
  • Self-contained files: a single HTML report, a demo or an offline page that must work without any other files.
  • JSON and APIs that carry images as text fields, such as an avatar in a configuration or a thumbnail in a test fixture.
  • Prototypes and code playgrounds where you can’t upload assets easily.

Where it doesn’t

  • Photos and large images. Base64 is about 33% larger than the file, and the tool shows the exact increase. A 200 KB photo becomes roughly 270 KB of text inside your HTML or CSS, which blocks rendering while it downloads.
  • Images used on several pages. A normal image file is cached once by the browser and reused. An inlined image is downloaded again inside every page or stylesheet that contains it.
  • HTML emails. Several widely used email apps, including Gmail, don’t display data-URL images. Host the image instead.

The tool warns you when an image is over 100 KB, a good rule of thumb for “probably shouldn’t be inlined”.

The snippets

After you drop or paste an image, you get five ready-to-copy versions:

Output Example use
Data URL Anywhere a URL is accepted
Base64 only JSON fields, APIs, config files that add the prefix themselves
HTML <img src="data:…" alt="" />. Remember to fill in the alt text
CSS background-image: url("data:…"); for icons in stylesheets
Markdown ![image](data:…) for notes and documentation tools that support it

The image is read byte for byte and isn’t re-compressed, so decoding the data URL gives back exactly the original file. To make the snippet smaller, shrink the image first with the Image Compressor or the Image Resizer.

SVG and ICO

SVG files encode fine, but because SVG is already text, URL-encoding it (escaping characters such as # and <) is often smaller than Base64 in CSS. For a few small icons the difference doesn’t matter. ICO files are accepted too, which is handy for inlining a favicon in a single-file page.

Decoding Base64 back to an image

Switch to Base64 → Image and paste either a full data URL or the bare Base64 text. The tool recognizes PNG, JPEG, GIF, WebP and SVG from the content itself, shows a preview, and offers the file for download. This is useful for debugging: checking what an API actually returned, extracting an image from a JSON fixture, or recovering an icon from an old stylesheet. If the text isn’t valid Base64, you’ll see an error instead of a broken image.

Security notes

Base64 isn’t encryption. Anyone can decode it, so don’t use it to hide anything. When you add data URLs to a site with a Content Security Policy, the policy must allow data: for images (img-src data:). Many strict policies do, but not all.

Everything here runs in your browser, so internal icons and screenshots aren’t uploaded. For text and files rather than images, use the Base64 Encoder.

Who encodes images as Base64

  • Front-end developers inline small icons and logos in HTML, CSS or JavaScript to avoid extra requests.
  • Email developers test inline images in HTML emails (with care, as many email clients block data URLs).
  • API developers send images inside JSON payloads, for example to an image-recognition service.
  • Technical writers embed small images directly in Markdown documents that must be a single file.
  • Testers create fixtures with embedded images for automated tests.

A complete example: an inline icon in CSS

  1. Open a small SVG or PNG icon, ideally under 5 KB.
  2. Copy the CSS snippet, a background-image rule with the data URL.
  3. Paste it into your stylesheet for the element that shows the icon.
  4. Check the size line: the Base64 version is about a third larger than the file.

A complete example: checking an image inside an API response

A JSON response contains a long Base64 string under an “image” field. Switch to Base64 → Image, paste the string, and the preview shows the picture; the type (PNG, JPEG and so on) is detected from the data. Download it to inspect it in an image viewer.

When to inline, and when not

Image Inline?
Tiny icons and simple SVGs Yes, often worth it
Images used on many pages No, a cached file is better
Photos and anything over about 100 KB No, it bloats HTML and CSS

Tips

  • Base64 is not encryption; anyone can decode the image.
  • Prefer SVG for icons; it stays sharp and is usually smaller.

Checked against the current version of the Image to Base64 on .

Troubleshooting

The file does not open

Check that it is one of the supported formats above and opens in another app. Damaged files and password-protected PDFs cannot be read until they are repaired or unlocked.

It is slow or stops on a very large file

Everything runs on your device, so speed depends on its memory. Close other tabs, use a computer rather than a phone, or split the file into smaller parts first.

The download did not start

Look for your browser’s download bar or icon. Some browsers ask once before a site may download files; allow it and click the button again.

Frequently asked questions

Why is the Base64 version larger than the image?

Base64 represents every 3 bytes of the file with 4 text characters, so the encoded text is about 33% larger. It's a way to put binary data inside text, not a compression method.

Can I use Base64 images in HTML emails?

It's unreliable. Several widely used email apps, Gmail among them, don't display images embedded as data URLs. For emails, host the image and link to it, or attach it.

Should I Base64-encode SVG icons for CSS?

It works, but SVG is already text. URL-encoding an SVG (with characters like # escaped) is often smaller than Base64. For a handful of small icons, either approach is fine.

How do I turn a Base64 string back into an image?

Switch to "Base64 → Image" and paste the string, with or without the data:image/...;base64, prefix. The tool detects the format, shows a preview and lets you download the file.

When should I inline images?

Only for small images such as icons. Base64 is about 33% larger than the file and cannot be cached separately.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.