Practical guide

Convert an image to Base64 or decode a data URI in your browser

Encode a small raster image for HTML or CSS, or inspect a Base64 image string with a local preview and download.

When an image data URI is useful

A data URI places binary image bytes into text so a small asset can be embedded in HTML, CSS, JSON, or another text-only field. It is convenient for tiny icons and test fixtures, but it usually makes the text about one third larger than the source image. For photos and larger artwork, a regular image file is often easier to cache and maintain.

Encode a small image

Open the Image to Base64 Converter and choose a supported PNG, JPEG, WebP, GIF, or BMP file no larger than 5 MB. Select data URI for a complete data:image/...;base64,... value, raw Base64 for the encoded body, CSS background for a CSS url(...) value, or HTML image snippet for an img tag. Copy the generated text into your project and test it in the intended browser.

Decode a Base64 image

Paste either a supported image data URI or its Base64 body into the decoder and choose Preview image. The tool checks the Base64 syntax and supported raster signature before creating a local preview. Download the image only after checking the detected format and preview.

Understand the trade-offs

Base64 does not compress the image; the encoded text is roughly 4/3 the original byte size, plus any data URI prefix. Embedding large images can increase HTML or CSS size, reduce cache flexibility, and make source files harder to read. Prefer external image assets for large or frequently reused files.

Privacy and format limits

The conversion runs in the current browser tab and does not upload the selected file or pasted text. Inputs are limited to 5 MB. SVG is rejected to avoid rendering active markup as an image payload. Animated GIF data is kept byte-for-byte when encoded, although a browser preview may show only one frame. This utility is not an image optimizer or a file safety scanner.

Try Image to Base64 Converter & Decoder →