Image toBase64& Data URL

Turn any image into a Base64 string or a ready-to-paste Data URL for HTML, CSS and JSON. Supports JPG, PNG, WebP, GIF, SVG and BMP. Everything runs locally in your browser, so your files never get uploaded — copy the result in one click.

Online Image to Base64 Converter

Drop an image here or click to select

One image at a time — encoded to Base64 in your browser

JPG • PNG • WebP • GIF • SVG • BMP

What is an image Data URL?

A Data URL is a way to embed an image directly inside text. Instead of pointing at a separate file withsrc="logo.png", the entire image is encoded as a Base64 string and prefixed with its MIME type — something likedata:image/png;base64,iVBORw0KGgo…. The browser decodes that string and renders the image with no extra network request. It works anywhere a normal image URL works: in HTML<img>tags, CSSurl(), favicons and more.

When Base64 helps — and when it doesn't

Base64 shines forsmall imageswhere cutting an HTTP request matters more than size: icons, tiny logos, UI sprites, favicons, email signatures and self-contained demo files. It is also handy for shipping a single HTML or CSS file with no external assets, or for sending an image inside a JSON payload to an API.

It is a poor fit forlarge photos. A Base64 string is about 33% larger than the original binary, it cannot be cached separately by the browser, and it blocks rendering while it decodes. For anything over a few kilobytes, a regular image file served with caching will almost always be faster.

The five output modes

ModeBest for
Data URIThe full data:image/… string, pasteable into a browser tab or any src.
Raw Base64Just the encoded characters — for JSON, databases or custom code.
CSS url()Drop straight into a stylesheet: background-image: url(data:…).
<img>A ready HTML tag with the Data URI already in the src attribute.
JSONThe Base64 wrapped and escaped as a JSON string value.

At a glance

PropertyDetail
FormatsJPG, PNG, WebP, GIF, SVG, BMP
LosslessYes — exact bytes encoded, fully reversible
Size change~33% larger than the binary original
Best forIcons, logos, sprites, email, single-file demos, API payloads
Privacy100% in-browser, no upload

Frequently asked questions

What is a Base64 image or Data URL?

A Data URL embeds an image directly inside text as a Base64-encoded string, prefixed with its MIME type — for exampledata:image/png;base64,iVBORw0…. Instead of linking to an external file, the whole image lives inside the HTML, CSS or JSON. This removes a separate network request, which is useful for small icons, email signatures, single-file demos and API payloads.

When should I use a Base64 image?

Base64 is best for small images (icons, logos, sprites under a few kilobytes) where avoiding an extra HTTP request matters more than file size, and for self-contained files like HTML emails or single-file demos. It is a poor choice for large photos: a Base64 string is roughly 33% larger than the binary file, so it increases transfer size and slows rendering for big images.

Which output format should I pick?

Raw Base64 gives you just the encoded string for JSON or custom code. Data URI gives the full data:image/... prefix for pasting straight into a browser tab or src attribute. CSS url() wraps it for stylesheets, HTML <img> for markup, and JSON escapes it for a JSON string value. Pick whichever matches where you will paste it.

Does converting to Base64 change my image?

No. Base64 is a reversible text encoding of the exact bytes of your file — nothing is re-compressed or re-sampled. The original image can be recovered byte-for-byte from the Base64 string. The conversion only changes how the file is represented, never its pixel content.

Is the Base64 converter free and private?

Yes. Encoding runs entirely in your browser with no upload, and it is free with no sign-up, no watermark and no usage limits. Your image is read locally and never sent to a server.