Image to Base64 Converter - Generate Data URIs Locally

Free online Image to Base64 converter. Encode PNG, JPG, SVG, WebP, or GIF images into Data URIs for CSS backgrounds and HTML img tags locally, with no uploads.

Click for theater mode

Conversion Results

Upload an image to see Data URI, CSS, and HTML code.

How to Use

  1. Drag a PNG, JPG, SVG, WebP, or GIF image into the upload area, or click to choose files.
  2. Confirm the image preview, MIME type, original size, and Data URI output size.
  3. Copy the full Data URI, raw Base64 string, CSS background-image, or HTML <img> snippet.
  4. Paste the code into CSS, HTML, email templates, or JSON configuration.

Example: click โ€œLoad SVG Sampleโ€ to generate a local SVG icon as a Data URI, then copy the CSS or HTML snippet.

Core Features

  • Instant Data URI Generation: Drop an image and generate a data:image/...;base64,... URI directly in your browser.
  • Ready-to-Use CSS & HTML: Copy CSS background-image or HTML <img> snippets without writing the Data URI prefix by hand.
  • Supports Web Image Formats: Works with PNG, JPG, SVG, WebP, GIF, AVIF, and other image formats your browser can read.
  • Batch Image Queue: Drop multiple icons, email assets, or UI images and copy the exact snippet you need per file.
  • 100% Private Processing: Images are read locally with the browser FileReader API. Nothing is uploaded.

Related Tools

FIRE Calculator 2026 (Inflation Adjusted) | Retirement Gap Simulator

The 2026 FIRE Calculator (Inflation Adjusted). Simulate real purchasing power, analyze retirement savings gaps, and generate a visual wealth roadmap. One-click CSV export for your Excel or Notion finance dashboard. 100% Private, client-side calculation.

Position Size Calculator - Risk-Based Trade Sizing

Calculate trade position size from account balance, risk %, entry, and stop loss. Runs locally in your browser with no uploads, so you can compare risk scenarios before you trade.

Compound Interest Calculator | Free APY & Investment Chart

Calculate compound interest from principal, recurring contributions, APY, and time. Visualize principal, interest, and final balance with a local interactive chart.

Online Loan & Mortgage Calculator - Instant Amortization Schedule

Use this Loan Calculator / Mortgage Calculator to estimate monthly payment, total interest, and an amortization schedule locally. Enter amount, rate, and term to calculate now with instant charts.

Online Investment & ROI Calculator - Compound Interest Visualizer

Use this Investment Calculator / ROI Calculator to estimate starting capital, monthly contributions, annual return, and inflation-adjusted results locally. Calculate projected returns with an instant compound interest chart, ROI, and yearly schedule.

APR to APY Calculator - Convert Nominal & Effective Rates

Use this APR to APY Calculator to convert between APR and APY locally. Enter a rate, choose compounding frequency, and see the effective interest rate, spread, and frequency comparison instantly.

Profit Margin Calculator - Margin vs Markup Converter

Use this Profit Margin Calculator to calculate gross profit, Markup, Margin, and selling price locally. Enter cost and price, or cost and target margin, then calculate your margins instantly.

CPM & CPC Calculator - Ad Spend and CTR Online Tool

Use this CPM Calculator and CPC Calculator to estimate ad spend, impressions, clicks, CPM, CPC, and CTR locally. Enter budget and target costs to plan campaign scenarios instantly.

Calculation Logic

Base64 encoding turns binary image data into an ASCII string, which lets images be embedded directly in HTML, CSS, or JSON. A Data URI follows the shape data:[mime-type];base64,[encoded-data], and browsers can read it as an image resource.

Important trade-off: Base64 is not image compression. Encoded output is usually about 33% larger than the original file, so it is best for small icons, logos, email images, or reducing a small number of HTTP requests. Large photos and many assets should usually remain as normal image files and be compressed separately.

FAQ

Why convert an image to Base64?

It is useful when you want to embed small icons, email images, or configuration images directly in code, reducing external requests or avoiding blocked remote email images.

Does Base64 reduce image size?

No. Base64 usually increases the encoded size by about 33%. It helps with embedding and request reduction, not storage compression.

What image formats are supported?

PNG, JPG, JPEG, SVG, WebP, GIF, AVIF, and any image format your browser can read.

Are my images uploaded?

No. Conversion uses the browser-native FileReader.readAsDataURL API, so files stay on your device.

Can I copy CSS or HTML directly?

Yes. Each image gets a full Data URI, raw Base64 string, CSS background-image, and HTML <img> snippet.