๐Ÿ”ฃ Image to Base64

Building a web page and want to write a small icon straight into your code instead of shipping a separate image file? Convert the image to Base64 / Data URI โ€” a single string you can embed in HTML or CSS. Conversion happens entirely in your browser; images are never uploaded to any server, and no sign-up is needed.

๐Ÿ“

Click to select an image, or drag it here

Supports JPG / PNG / WebP / GIF / SVG โ€” small images under 500KB recommended

How to Use

  1. Click the dashed box to pick an image (icons and logos work best), or drag it in.
  2. The tool converts it to Base64 automatically, showing a preview, the original size, and the encoded length.
  3. Choose the output format: Data URI pastes straight into <img src="/tools/..."> or CSS url(...); raw Base64 suits JSON or code variables.
  4. Click "Copy result" and paste it into your code.

When should you use Base64?

Base64 is for small images: web icons, button backgrounds, tiny logos in email templates. The upside is one less HTTP request and the image travels with your code. The cost is ~33% size bloat plus no browser caching โ€” so never convert large images: a 2MB photo becomes a ~2.7MB string that will choke your page. Rule of thumb: under 10KB, go for it; over 100KB, serve the file normally.

A Data URI looks like data:image type;base64,encoded content โ€” for example data:image/png;base64,iVBORw0โ€ฆ. When a browser sees data:, it knows inline data follows and renders it directly with no extra request.

FAQ

Will my images be uploaded?
No. Reading and encoding happen entirely in your browser โ€” no image data ever leaves your device.
Why is the Base64 larger than the original?
Base64 represents binary data with 64 printable characters: every 3 bytes become 4 characters, a fixed ~33% bloat. That's the cost of the encoding itself, not this tool.
Data URI or raw Base64 โ€” which one?
Pick Data URI (with the data:image/png;base64, prefix) for embedding in web pages; raw Base64 for databases, JSON, or code variables. Same content, just a different prefix.
Can I convert large images?
Technically yes, but it's not recommended. Oversized Base64 strings slow down editors and pages. Compress large images first with this site's "Image Compressor" to under 100KB before converting.
How do I turn Base64 back into an image?
Paste the Data URI into your browser's address bar and hit Enter to view the image, then right-click to save it. You can also use this site's "Base64 Encode & Decode" tool for reverse decoding.

Related Tools

๐Ÿ“„ SyncPage โ€” real-time document collaboration Review PDFs, slides, Word & Excel files together โ€” present live, annotate in real time, talk by voice. Guests join free from an invite link. Try SyncPage โ†’