Convert an Image to Base64
Drop any image and instantly copy its Base64 string, data URI, or ready CSS/HTML snippet — free and right in your browser.
Trascina un'immagine da codificare
Trascina, incolla o scegli un file
PNG · JPG · WebP · GIF · SVG — codificato sul tuo dispositivo
Why convert an image to Base64?
Base64 turns an image's binary data into plain text, so you can paste it directly into code instead of linking to a separate file. It's the standard way to inline a small icon, logo, or background into a CSS file, an HTML email, a JSON payload, or a data URI — removing one extra network request and keeping everything self-contained.
This tool reads your file in the browser and shows the exact Base64 representation of the original bytes — no re-compression, no quality change. You get the raw Base64 body, the full data:image/…;base64 URI, and ready-to-paste CSS and HTML snippets, each with a one-tap copy and a .txt download.
How to convert an image to Base64
- Open your image. Drag a PNG, JPG, WebP, GIF, or SVG onto the tool above, choose a file, or paste from your clipboard.
- Pick the output you need. Switch between the raw Base64 string, the full data URI, a CSS background-image rule, or an <img> tag.
- Copy or download. Tap Copy to put it on your clipboard, or download the string as a .txt file.
Keep inline images small
Base64 adds about a third to the byte size, so inlining is best for small assets — icons, sprites, tiny logos. For large photos, a normal file or URL stays smaller and the browser can cache it separately.
More Base64 & data URI tools
Domande frequenti
Does converting to Base64 lose quality?
No. Base64 is a lossless text encoding of the exact original file bytes, so the image is unchanged. Decoding gives back a byte-for-byte identical file.
What's the difference between the Base64 and the data URI?
The raw Base64 is just the encoded body. The data URI adds the data:image/…;base64, prefix so a browser can use the string directly as an image source.
Which formats can I encode?
PNG, JPG, WebP, GIF, BMP, SVG, AVIF, and ICO. The data URI's media type matches the file you opened.
Where is my image processed?
The encoding and decoding happen in your browser, so the result is created on your own device. How any data associated with the tool is handled is described in our privacy policy.
Altri strumenti immagine
Crop an image
Crop to any ratio or an exact pixel size.
Image toolCompress an image
Shrink file size without visible quality loss.
Image toolResize an image
Change dimensions to exact pixels or presets.
Image toolConvert HEIC to JPG
Turn iPhone HEIC photos into universal JPG.
Image toolConvert image format
PNG, JPG and WebP — convert any to any.