Image to Base64
Pick an image and get its Base64 string, ready to copy as a Data URI, raw Base64, HTML or CSS โ processed right in your browser.
How to use
- 1Choose or drag and drop an image file.
- 2Pick the output: Data URI, Base64 only, HTML <img> tag or CSS background.
- 3Click "Copy" to copy it to the clipboard, or click the result box to select the whole string.
Supported formats and limits
- Accepts any image file. The preview only appears for formats your browser can display; an HEIC photo, for example, has no preview but is still encoded normally.
- The Base64 string is an exact encoding of the original file: the image is not recompressed, resized or converted.
- The Base64 string is about 33% larger than the file, because every 3 bytes become 4 characters.
- The Data URI uses the file type your browser reports, for example data:image/png;base64,โฆ
Privacy
The file is read and encoded in your browser. It is not uploaded to a server.
Frequently asked questions
What is the difference between a Data URI and Base64?
Base64 is just the encoded data. A Data URI adds a "data:image/โฆ;base64," prefix that tells the browser what kind of image it is, so it can go straight into an <img> src attribute or a CSS url().
When should I embed images as Base64?
It suits small images such as icons, logos or pictures in HTML emails, saving a separate file request. For large images the long string makes your HTML or CSS heavier, so a normal image file is usually better.
Why is the result longer than the original file?
Base64 uses 4 characters for every 3 bytes of data, so the text is always about a third larger than the file.
How do I turn Base64 back into an image?
Use the Base64 to Image tool: paste the string, check the preview and download the file.
Related tools
- Base64 to ImagePaste a Base64 string or Data URI to preview the image and download it.
- Image ConverterConvert HEIC to JPG, JPG to PNG, WebP to JPG and more โ between JPG, PNG, WebP, BMP and ICO, one or many at a time.
- Image CompressorReduce JPG/PNG image file size while keeping reasonable quality.
- Remove BackgroundAutomatically remove the background from a photo and save it as a transparent PNG.
Everything runs right in your browser โ files are never uploaded to any server.