Image to Base64
Turn an image into a Base64 data URI for embedding in code.
What this tool does
Sometimes you need an image as text rather than a file — for example, to embed it directly in HTML, CSS or JSON. This tool converts your image into a Base64 data string you can paste into code.
When to use it
- You want to embed a small icon directly in a CSS or HTML file.
- You need to include an image inside a JSON payload.
- You are building a self-contained page with no separate image files.
- You want to pass an image through a text-only system.
How to understand this tool
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA... — a data URI you can paste straight into CSS or HTML src, no separate file needed.
The output is a data URI: the image itself is written as text inside the HTML or CSS, which removes one network request but adds roughly a third to the size. It suits icons, logos and tiny graphics; embedding a photograph this way usually makes the page slower, not faster.
What it will not do
- It does not compress the image first.
- It produces text, not an image file, so very large images create unwieldy code.
Questions people ask
What is a data URL?
It is an image encoded as a text string that begins with "data:image", so it can live inside code.
Should I use this for large photos?
Usually not — the string becomes huge and can bloat your page. Use it for small images.
One thing worth knowing
Data URIs are handy for small icons in CSS or HTML, but they bloat files. For large photos, use a normal image file.