PNG to Base64 Converter
Convert PNG to Base64 online and keep transparency intact. PNG to Base64 is popular for logos, icons, screenshots and UI graphics that you want to embed directly in HTML, CSS or JavaScript code.
Convert JPG, PNG, WebP and GIF images to Base64 string, data URI, HTML or CSS code. Fast, free and no signup.
Add your images by dragging them in or browsing your device.
Pick Data URI, Base64 string, HTML img tag or CSS background.
Copy the code with one click or save it as a text file.
Looking for a free image to Base64 converter? Convert any JPG, PNG, WebP or GIF image to a Base64 string online in seconds. Upload your image, choose the output type, and get a Base64 string, a data URI, a ready-to-use HTML img tag or a CSS background-image line. There is no software to install, no account to create and no watermark on the result. Whether you are a web developer embedding small icons in HTML or CSS, an app developer sending an image inside a JSON API request, or someone who simply needs a Base64 image code, this online image encoder makes the job quick and simple. Copy the output with one click or download it as a text file.
Convert PNG to Base64 online and keep transparency intact. PNG to Base64 is popular for logos, icons, screenshots and UI graphics that you want to embed directly in HTML, CSS or JavaScript code.
Use the JPG to Base64 converter to turn JPG and JPEG photos into a Base64 string or data URI. It is useful for small previews, thumbnails, email templates and API requests that accept image data as text.
Convert WebP to Base64 to embed modern, lightweight images in your code. WebP images are often smaller than JPG or PNG, which keeps the final Base64 string shorter.
Base64 is an encoding method that converts binary data, such as the bytes of an image file, into plain text. The text uses only 64 safe characters: capital letters, small letters, numbers, plus and slash. Because the result is normal text, a Base64 image can travel safely through systems that only handle text, such as HTML documents, CSS files, JSON data, XML, email bodies and many web APIs.
When you convert an image to Base64, the image is not changed visually. The same picture is simply written in a text form that can be decoded back into the original image at any time. This is why Base64 is often called an image encoder and not a compressor.
Converting an image to a Base64 string with this tool takes only a few steps. You do not need to write any code or install a program.
Each image can be up to 5 MB. For the best results, use small images and optimize them before conversion.
The same encoded image can be written in four useful formats. This converter lets you pick the one that matches your project.
To show a Base64 image in HTML, put the data URI inside the src attribute of an image tag. The browser reads the image from the code itself, so it does not need to download a separate file.
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUg..." alt="My image">
Choose the HTML img tag output in the converter and you get this complete tag generated for you, with the full Base64 data included.
In CSS you can use a Base64 image as a background by placing the data URI inside the url() function. This is handy for small icons and patterns because it removes an extra file request.
.logo {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...");
background-repeat: no-repeat;
}
Select CSS background in the settings and copy the ready-made line into your stylesheet.
Many REST APIs accept images as a Base64 string inside a JSON body, for example for profile pictures, document uploads, OCR services and AI image analysis. Choose the Base64 string output, copy it and place it in the correct field of your request.
{
"image": "iVBORw0KGgoAAAANSUhEUg...",
"type": "image/png"
}
Advantages: A Base64 image removes the need for a separate image file, which can save an extra request for tiny images. It also makes images easy to move through text-only systems and keeps everything in a single document.
Disadvantages: Base64 increases the data size by roughly 33 percent compared with the original image. Browsers cannot cache an inline Base64 image separately from the page or stylesheet that contains it, and long strings make code harder to read. For these reasons, Base64 is best for small images and is not a good choice for large photos or for many big images on one page.
A good rule is to use Base64 for small icons and logos, and use normal image files for large pictures.
This online image to Base64 converter works in any modern web browser on desktop, tablet and mobile. You can convert an image to a Base64 string, create a data URI, or generate HTML and CSS code without installing a desktop program, a browser extension or a code library. It is a fast way to encode images when you need a Base64 image code right now. The tool is free, requires no signup and adds no watermark.
Find answers to common questions about converting images to Base64, data URIs, and using Base64 images in HTML, CSS and APIs.
Upload your JPG, PNG, WebP or GIF image to the Image to Base64 converter, choose the output type such as Data URI, Base64 string, HTML img tag or CSS background, and click Convert to Base64. When the conversion is complete you can copy the result or download it as a text file.
Base64 image encoding turns the binary data of an image into a plain text string made of letters, numbers and a few symbols. Because the result is text, it can be placed inside HTML, CSS, JSON, XML, emails and API requests without sending a separate image file.
A Base64 string is only the encoded image data. A data URI adds a prefix such as data:image/png;base64, in front of that string, so browsers know the file type and can display the image directly when it is used in an img tag or in CSS.
Choose the HTML img tag output, copy the code and paste it into your page. You can also copy the data URI and use it as the src value of an img element. The image is then loaded from the code itself and no separate image request is needed.
Choose the CSS background output and copy the line. It looks like background-image: url with the data URI inside, and you can paste it into any CSS rule. This is useful for small icons, logos and patterns.
Yes. This converter supports JPG, JPEG, PNG, WebP and GIF images. The correct MIME type, for example image/png or image/jpeg, is detected automatically and added to the data URI.
Yes. Base64 encoding increases the size of the data by roughly 33 percent compared with the original binary file. For this reason Base64 is best for small images such as icons and logos, and not for large photos.
No. Base64 is an encoding method, not a compression method. It does not reduce image quality or file size. If you want a smaller file, compress the image first and then convert it to Base64.
Yes. You can upload up to 10 images at the same time. Each image gets its own Base64 output, and you can copy or download them one by one or download everything together in a ZIP file.
Each image can be up to 5 MB and you can upload up to 10 images per conversion. Very large images create very long Base64 strings that are hard to use in code, so smaller images are recommended.
Yes. A Base64 string or data URI can be decoded back into the original image by browsers, programming languages and Base64 decoders. If you save the data URI as the src of an img tag, the browser shows the image automatically.
Your files are used only to create the Base64 output and are deleted automatically a few minutes after processing. Even so, avoid uploading highly confidential images to any online service.
Yes. The tool is completely free to use, with no signup and no watermark.
Merge, split, compress and convert files in seconds. Explore powerful free tools for all your everyday needs.
Explore All Tools →