Image tools

Image to Base64 converter

Convert PNG, JPG, WebP, GIF or SVG to Base64, a data URL, HTML image tag or CSS background. Copy or download complete output privately.

Private · processed on your device

Choose an image

Drop one PNG, JPG, WebP, GIF or SVG.

Up to 5 MiB; SVG up to 512 KiB. Original file bytes, animation and metadata are preserved.

No image selected.

Undo changes restores your image and output settings after edits or Clear. An accepted replacement image ends recovery.

Choose an image to encode.

Copy the format you need

Use the complete data URL where an image URL is accepted.

The first 4,096 characters appear here. Copy and download include the complete output.

Base64 is an encoding, not encryption or compression. It increases size by roughly one third and keeps embedded metadata, including any location tags.

Choose the output your project expects

A data URL combines the detected MIME type and Base64 bytes. Raw Base64 omits that prefix for APIs that take the type separately. HTML output adds an image element with escaped alternative text, while CSS output provides a background-image declaration. These snippets are displayed as text and never executed here.

Preserve the exact image file

Encoding does not resize, compress, strip metadata or change animation. Decoding the Base64 returns the original bytes. Embedded location or author information remains present. Use Image format converter first if you want a fresh still-image export without metadata.

Use inline images thoughtfully

Base64 uses four characters for each three input bytes, with padding for the final group. It increases uncompressed size by roughly one third. Large inline images make documents harder to edit and cannot be cached separately; ordinary image URLs are usually more practical for larger website assets. Support for data URLs depends on the application and its content security policy.

Limits and preview behavior

One PNG, JPG, WebP, GIF or UTF-8 SVG at a time, up to 5 MiB; SVG is limited to 512 KiB and must be well-formed with the SVG namespace. SVG document/entity declarations are rejected, but original SVG content is not sanitized and is never rendered here. Raster format detection reads image headers, not complete pixel integrity. Snapshot failures do not alter the encoded bytes.

Raster previews are static and limited to 12 million pixels and 4,096 pixels per side. Larger supported headers can still be encoded without decoding pixels. The output field shows up to 4,096 characters; Copy and Download include everything. Encoding runs in a local worker with a 15-second deadline; Cancel processing terminates it while preserving any previous output. Undo changes restores the image, snapshot and output settings after edits or Clear; an accepted replacement ends recovery. No image, code or metadata is uploaded or saved.

Related tools

Image metadata viewer · Batch image resizer · Image to ICO