To convert an image to Base64, open Image to Base64, choose your file and copy the data URL it produces. You can paste it directly into HTML or CSS, and the image is never uploaded.
Follow along with the free Image to Base64, which runs in your browser, or browse more tools in this category.
How to use the Image to Base64
- Choose the image.
- Wait for the data URL to be generated.
- Copy it.
- Paste it into an img src or a CSS url().
Worked example
A data URL begins with data:image/png;base64, followed by the encoded bytes.
Tips and common mistakes
- Base64 makes the data about a third larger, so use it for small images such as icons.
- Inlining saves a request but cannot be cached separately.
- Compress the image first to keep the string short.
Frequently asked questions
What is a data URL?
A URL that contains the file data itself instead of pointing to a separate file.
When should I use it?
For tiny images where avoiding an extra request matters.
Is it private?
Yes.