Convert images to Base64 data URLs

Embed images directly in HTML, CSS, or JSON. No server uploads — 100% private.

base64-converter.js
1const img = await loadImage(file);
2const canvas = document.createElement("canvas");
3const ctx = canvas.getContext("2d");
4ctx.drawImage(img, 0, 0);
5const dataUrl = canvas.toDataURL();
6return btoa(dataUrl);

Drop images here

or click to browse

JPGPNGWebPAVIFHEIC

Files never leave your browser

Output settings

Choose how Base64 is delivered.

Processing runs locally in your browser.

Convert images to Base64 in three steps

Upload locally, convert instantly, and copy or download text files.

Upload images or ZIP

Drag and drop files or a ZIP archive with folders.

Generate Base64

We encode each image locally with no uploads.

Copy or download

Copy to clipboard or download a ZIP of .txt files.

When to use Base64 images

Common scenarios where inline Base64 encoding improves performance and simplifies deployment.

HTML & CSS embeds

Inline small images directly in code to reduce HTTP requests and improve initial load time.

Email templates

Embed logos and icons in HTML emails so they display without image blocking.

API integrations

Send images to AI vision APIs, cloud storage, or webhooks that expect Base64 payloads.

Single-file apps

Bundle all assets into one HTML file for offline tools, demos, or portable documents.

Base64 encoding questions

Everything developers need to know about inline image embedding.

What is Base64 encoding used for?

Base64 turns an image into text so it can be embedded directly inside HTML img tags, CSS background-image properties, JSON API payloads, and email templates without requiring separate file downloads.

Should I use a Data URL or raw Base64?

Use a Data URL (with the data:image/...;base64 prefix) for HTML and CSS embeds. Use raw Base64 when sending to APIs like OpenAI Vision, uploading to cloud services, or when the receiving system adds its own prefix.

How do I embed Base64 in HTML?

Use the Data URL directly in the src attribute: <img src="data:image/png;base64,..." />. This eliminates an HTTP request and the image loads instantly with the page.

How do I use Base64 in CSS?

Set it as a background-image: background-image: url("data:image/png;base64,..."). Great for small icons, patterns, and UI elements that need to load without flicker.

Are my images uploaded to a server?

No. All Base64 conversion happens locally in your browser using JavaScript. Your images never leave your device, making this 100% private and secure.

Can I convert a ZIP with folders inside?

Yes. ZIP uploads are fully supported. Folder structure is preserved when you download all Base64 files as a ZIP, making batch processing easy.

Does Base64 increase file size?

Yes, Base64 encoding increases size by approximately 33%. For small images (icons, logos under 10KB), this is fine. For larger images, consider compressing first with our main tool.

Is there a file size limit?

Individual files are limited to 25MB to keep browser performance smooth. For best results with Base64, use images under 100KB to avoid bloating your HTML/CSS.

Need smaller files first?

Compress images before encoding for faster embeds and better performance.