Image to Base64 Converter

Drop an image in and copy the Base64 string, or the full data: URL if you want to use it directly in markup. The file never leaves your browser, so private screenshots and product shots stay on your machine.

b64file — converter · local

Processed as you paste — no button to press (Ctrl+Enter converts now / Esc clears)

Paste, drag and drop, or Ctrl+V a screenshot

[01]

Using it in HTML

With the data: URL option enabled, the output drops straight into an img tag — useful for one-off assets, email templates and pages that must render from a single file.

<img src="data:image/png;base64,iVBORw0KGgo..." alt="Logo" />
[02]

Using it in CSS

Background images and icons work the same way, and a small asset inlined this way removes a request from the critical path.

.icon { background-image: url("data:image/svg+xml;base64,PHN2Zy..."); }
[03]

Things to watch out for

  • Size — inlining adds about 33 percent, and it cannot be cached separately from the page
  • Wrapping — the data: URL must stay on one line; if you wrap at 76 characters, do not add the prefix
  • Readability — large inline blobs make source files hard to diff and review; keep them for small assets

Frequently asked questions

The encoded string is enormous — can I shrink it?

Base64 is a fixed 33 percent overhead, so the real lever is the image itself: resize or compress before encoding. For icons, an inline SVG is usually far smaller and scales better.

Can the output go straight into CSS?

Yes, with the data: URL option on and line wrapping off. Wrapped output is only for formats like MIME and PEM that expect fixed-width lines.

Is there a size limit?

Up to 100 MB per file. For anything over a few megabytes, consider whether the asset really belongs inline — browsers handle a separate file far better.

Related tools and guides