# Image to Base64 Converter

> Image to Base64 converter: turn PNG, JPG and WebP images into a data URI, CSS background, HTML img tag or Markdown. No upload, converted in your browser.

Source: https://widgetpantry.com/en/image-to-base64 · Türkçe: https://widgetpantry.com/tr/resim-base64-cevirici

Drop an image to get its Base64 text, data URI, CSS background-image and HTML img tag. The file never leaves your computer; it is converted in your browser.

Runs in your browser: files and text are not uploaded. [Use the tool](https://widgetpantry.com/en/image-to-base64)

## How to use it

1. Drag an image in or press Choose file.
2. Pick the format you need: data URI, plain Base64, CSS, HTML or Markdown.
3. Press Copy and paste the code into your page or email.

## What it is for

Base64 turns a binary file into text made only of letters, digits and a few symbols. As a data URI (data:image/png;base64,…) an image can be embedded in HTML, CSS, JSON or an email template without a separate file.

The text is about a third larger than the file (every 3 bytes become 4 characters) and cannot be cached separately by the browser, so it suits small icons, logos and email images; large photos load faster as normal files.

The file type is read from the file's first bytes, not its extension, so the right MIME type is written even for a misnamed file. Files up to 10 MB are converted.

## Frequently asked questions

### Is my image uploaded to a server?

No. The file is read and converted in your browser and is not sent anywhere.

### What is the difference between a data URI and plain Base64?

Plain Base64 is only the encoded text. A data URI adds the type in front (data:image/png;base64,) and can go straight into an img src or a CSS url().

### How do I turn Base64 back into an image?

Paste the data URI into your browser's address bar and the image opens; right-click to save it. You can also decode the text with the Base64 converter on this site.

### Are SVG or GIF supported?

For now PNG, JPG and WebP are supported. SVG is already text, so it can usually be embedded directly.

## Related tools

- [Base64 Encode/Decode](https://widgetpantry.com/en/base64-encode-decode): Base64 encode and decode online: turn text into Base64 or Base64 back into text. UTF-8, emoji and base64url support. Runs in your browser.
- [Compress Image](https://widgetpantry.com/en/compress-image): Compress JPG, PNG and WebP images right in your browser. Set the quality with a slider and see exactly how much you saved. No uploads, no sign-up.
- [Image Converter](https://widgetpantry.com/en/image-converter): Convert PNG, JPG and WebP images to each other in your browser: several files at once, adjustable quality. Your images are never uploaded.
