Image to Base64
Convert an image to a Base64 data URI for use in CSS or HTML.
…or drag & drop an image here
Runs in your browser. Nothing you open or type here is uploaded.
How to use
- Choose an image file, or drag and drop one onto the workspace.
- Read the data URI in the output field — the character count is shown above it.
- Copy the data URI and paste it into your CSS or HTML.
Details
A data URI carries the image itself inside a text string, prefixed with its MIME type, so a document can display the picture without a separate file request. This tool reads PNG, JPEG, WebP, GIF or SVG files and encodes them as Base64, keeping the original MIME type. Base64 represents three bytes with four characters, so the encoded text is about 33% larger than the file it replaces.
- Embed small images only: icons, logos and tiny graphics. A large photo belongs in its own file, where the browser can cache it.
- In CSS, the URI goes inside url("...") as a background value; in HTML, it goes in the src attribute of an img tag.
Common questions
Which formats work?
PNG, JPEG, WebP, GIF, SVG — anything your browser can load. The data URI keeps the original MIME type.
Why is the output bigger than my file?
Base64 inflates size by about 33%. Embed small images only; large ones belong as separate files.
Is my image uploaded?
No — everything runs in your browser. Your image never leaves your device.