Image to Base64

Convert an image to a Base64-encoded string or data URI directly in your browser, with no upload to a server. Useful for embedding icons in CSS, inlining images in HTML email, or including image data in JSON or a mock API response.

Drag and drop an image, or click to choose one

Select a single file

Usage examples

Embedding a small icon directly in CSS

Use it to drop the result straight into CSS's background-image: url(data:image/png;base64,...), avoiding a separate image request.

Including an image inside JSON or a config file

Useful when you want to embed sample image data as text inside code or a config file, without a server request.

Inlining an image in HTML email

For mail clients that block external image links, converting an image to a Data URI lets you embed it directly in the HTML.

Mocking an API response that includes image data

Generate a Base64 string to drop into a fixture or mock JSON payload when you need a placeholder image field for a frontend test.

Storing a tiny logo in a single-file component or script

Keep a self-contained component or build script free of extra asset files by embedding a small logo or favicon as a Base64 string directly in the source.

Frequently asked questions

Is my uploaded image sent to a server?

No. Conversion happens entirely in your browser, and the image is never sent to a server.

What's the difference between Data URI and Base64 only?

A Data URI is the full string starting with data:image/png;base64,, ready to paste directly into <img src="..."> or a CSS url(). Base64 only is just the raw encoded value that follows it, useful when you're assembling the format string yourself somewhere else.

Does converting to Base64 make the data bigger?

Yes. Base64 encoding is roughly 33% larger than the original. That's the trade-off for representing binary image data safely as text, so it's best to avoid shipping large images this way unless you specifically need to.

What image formats are supported?

JPG, PNG, WebP, GIF, and most other image formats your browser can read.

Why shouldn't I embed every image on my site as Base64?

Base64 images can't be cached separately by the browser the way a regular image file can, and the ~33% size increase is applied every time the page loads. They're best reserved for small, one-off assets like icons, not large photos or images that repeat across many pages.

Will the Data URI work the same in every browser?

Yes. The data: URI scheme is a web standard supported by all modern browsers, so an <img> tag, CSS url(), or fetch target using a Data URI behaves the same across Chrome, Firefox, Safari, and Edge.

Does this tool resize or compress my image?

No. The output encodes the exact bytes of the file you selected — it doesn't resize, recompress, or strip metadata. If you need a smaller result, compress or resize the image first before converting it.