Image to Base64 Online — Data URI in Browser

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

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

How conversion works

Pick a PNG, JPEG, GIF, WebP, or SVG file (max 2 MiB). Choose data URI or raw Base64. Preview renders via an img element — SVG is never injected into the DOM as markup.

Options

Output format
dataUri for CSS/src attributes; 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?

2 MiB. Larger files are rejected — 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?

Preview uses only an img with a data URI — never inline SVG DOM injection.

Looking for converters, encoders, formatters, and minifiers in one place? Developer tools hub Open the curated developer tools catalogue.