Image to Base64 Online — Data URI in Browser

Convert a local image (PNG, JPEG, GIF, WebP, SVG) to Base64 or a data URI. The limit is 32 MiB, and nothing is uploaded.

Loading…
Image to Base64 data URIs
Encode a local image file as Base64 or a data URI. 32 MiB limit. Preview uses img src only.

How conversion works

Pick a PNG, JPEG, GIF, WebP, or SVG file (max 32 MiB). Choose data URI or raw Base64. The preview renders through an img element, and SVG is never injected into the DOM as markup.

Options

Output format
dataUri for CSS and src attributes, and rawBase64 to pipe into other tools.

Examples

Data URI

Input

icon.png (local file)

Output shape

data:image/png;base64,iVBOR…

Raw Base64

Input

photo.webp

Output shape

iVBOR… (no data: prefix)

Related tools

For text Base64 use base64. For SVG-specific data URIs see svg-to-data-uri.

Image to Base64 FAQ

Limits & formats

What is the size limit?

32 MiB. Larger files are rejected, and there is no unlimited upload.

Why does Base64 expand size?

Base64 expands binary data by about 33%. Prefer files or CDN URLs for production assets.

Is SVG preview safe?

Yes. The preview uses only an img element with a data URI, and it never injects SVG into the DOM.

Encode or decode Base64, URLs, HTML entities and JWTs, and generate hashes and HMACs in your browser.