Menu

Image to Base64 Obfuscator

Encode any image into a Base64 data URI. Preview, copy, or download the encoded string, and generate ready-to-paste HTML, CSS, or JavaScript snippets. Everything runs in your browser.

Image to Base64 Studio Browser-Only
Ready

Drop an image here or click to browse

PNG, JPG, GIF, WebP, SVG, BMP, ICO, AVIF — max 5 MB

Everything is processed locally. Nothing is uploaded.
🔤 Raw Base64 mode. Outputs only the Base64 string without any prefix. Use it when you need the raw bytes for a JSON payload, database field, or custom wrapper.
Base64 inflates size by ~33%. Inline images bypass HTTP caching and are re-downloaded with every page load. Only inline small images (icons, logos, tiny SVGs) — keep larger images as separate files.
0 = no line breaks · 76 = MIME standard
Complete Guide to Image Base64 Encoding

What Base64 Image Encoding Actually Does

Base64 encoding converts binary image data into an ASCII string. The result can be embedded directly into HTML, CSS, JavaScript, or JSON without a separate file fetch. A Base64-encoded image is typically used as a data URI:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAB...">

The browser decodes the string back into an image at render time. This is useful for small assets — icons, logos, tiny SVG graphics — where the HTTP request overhead outweighs the size increase.

The Five Output Modes

ModeOutputUse Case
🔤 Raw Base64Just the encoded stringJSON payloads, databases, custom wrappers
🔗 Data URIdata:image/png;base64,...Direct src or url() value
📄 HTML Tag<img src="data:...">Paste directly into HTML
🎨 CSS Rule.cls { background-image: url(data:...); }Inline backgrounds, icons
⚙️ JS Snippetconst img = "data:...";Dynamic image loading

Size Reality

Base64 inflates size by ~33%. A 10 KB PNG becomes ~13.3 KB of Base64 text. Worse, inline data URIs are not cached separately — they're re-downloaded with every page load that references them. Keep inline images small (under ~10 KB) and use real files for anything larger.

When to Inline (and When Not To)

Use Inline Base64Use a Real File
Small icons (< 5 KB)Photographs and large images
Tiny SVG logosImages used in many pages (cache benefit)
Email templates (no external fetch)Images that change frequently
Single-page apps with critical inline assetsAnything over ~10 KB
CSS gradients / patternsHero images, product photos

SVG Special Case

SVG is text, so it can be inlined as data:image/svg+xml;base64,... or directly as data:image/svg+xml;utf8,<svg>...</svg>. The Base64 version is safer for complex SVGs with quotes and special characters. For simple SVGs, the utf8 form is smaller and more readable.

What Base64 Encoding Cannot Do

  • It cannot hide image content. Anyone can decode Base64 in seconds. It's encoding, not encryption.
  • It cannot compress images. It makes them larger, not smaller. Use a real image optimizer first.
  • It cannot improve performance for large images. It usually makes things worse by preventing caching.
  • It cannot replace a CDN. For production assets, use a CDN with proper cache headers.

Frequently Asked Questions

Is Base64 image encoding secure?
No. Base64 is encoding, not encryption. Anyone can decode it in seconds. Never use it to hide sensitive image content.
Does Base64 make my images smaller?
No — it makes them ~33% larger. Base64 is used for inlining, not compression. Compress your images first with a proper optimizer, then encode.
Why is my Base64 image not loading?
Common causes: (1) wrong MIME type in the data URI, (2) truncated string, (3) missing base64, prefix, (4) the image format is not supported by the browser. Check the Data URI mode output for the correct format.
Can I use Base64 images in email?
Yes, but support varies. Outlook (desktop) and some older clients block data URIs. For critical email images, host them on a server and link normally.
What's the maximum file size?
This tool caps at 5 MB for browser performance. For production, inline images should be under 10 KB — anything larger defeats the purpose.
Does Base64 work with SVG?
Yes. SVG can be Base64-encoded as data:image/svg+xml;base64,.... For simple SVGs, the utf8 form data:image/svg+xml;utf8,<svg>...</svg> is smaller and more readable.
Why does the output have line breaks?
MIME standard wraps Base64 at 76 characters. Set the Wrap field to 0 for a single-line output (modern browsers and most APIs accept both).
Can I decode Base64 back to an image?
Yes. Paste the Base64 string into any Base64 decoder, or use the browser: create a data URI and open it in a new tab. The raw Base64 mode gives you the string without the prefix.
Is my image uploaded to your server?
No. Everything runs in your browser using the FileReader API. Your image never leaves your device.
Should I inline all my images?
No. Inline only small, frequently-used assets (icons, logos). Large images should be real files served with proper cache headers — otherwise you lose HTTP caching and bloat your HTML/CSS.
What is a data URI?
A data URI is a URL scheme that embeds the resource directly in the URL: data:[<mime>][;base64],<data>. Browsers can render data URIs anywhere a normal URL is accepted.

Related Tools