Image to Base64 Online
Convert a local image to a Base64 data URI, HTML image tag or CSS background.
Open Image to Base64Free · No sign-up · Browser-based processing
What Image to Base64 does
Encode the original bytes of a local PNG, JPEG, GIF, WebP, AVIF or ICO image as a data URI. No resize or re-encoding occurs. Base64 increases payload size by roughly one third and can reduce cache reuse, so small embedded icons are usually a better fit than large photos.
Common uses
- Embed small icons in HTML or CSS
- Prepare self-contained prototypes
How to use Image to Base64
- Choose a supported local image, up to 10 MB.
- Select data-uri, html or css output.
- Run conversion and copy the resulting embedding code.
Privacy: Runs locally in your browser. Input is not uploaded to the DevNet Kit server.
Image to Base64 example
Try the tool with this representative input:
Options
data-uriExpected result
A selected PNG produces a data:image/png;base64, URI.Image to Base64 FAQ
Are image dimensions changed?
No. The original image bytes are encoded without modification.
Does it support SVG?
This uploader accepts raster image formats and ICO. Use SVG Optimizer for SVG markup.
Select the downloadable PNG and encode its original bytes
Download the sample PNG and select it in the file picker; do not paste its filename as image data. Choose data-uri to obtain its media-type prefix and Base64 payload. The html and css modes wrap the same URI in an image tag or background declaration. Processing reads the selected file rather than downloading an image URL.
Base64 encoding preserves the file bytes, including embedded metadata. It does not resize, compress, remove EXIF or encrypt the image. The payload contains 4 × ceil(n/3) characters for n bytes, plus the data URI prefix. The file interface accepts its listed raster formats up to 10 MiB, not SVG; HTML output supplies an empty alt attribute that you should set according to the image purpose.
Worked example
Download the example file (seo-sample-red.png)
Input and settings:
seo-sample-red.png
image/png
96 × 96 pxOptions:
data-uriExpected result or interpretation:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAABl0lEQVR4AezTQQrDQAwEQZP//zl5gg5iadupQE5CGm838/le19e/Y/C5/FICBKT4r4sAAmICcbwGEBATiOM1gICYQByvAQQEBG4UqQGxDAIIiAnE8RpAQEwgjtcAAmICcbwGEBATiOM14H8ExC+9abwGxGIIICAmEMdrAAExgTheAwiICcTxGkBATCCO14DDAqbzBEyEDs8JOAx4Ok/AROjwnIDDgKfzBEyEDs8JOAx4Ok/AROjwnIDDgKfzBEyEDs8JOAx4Ov9OAdOrbzQnIJZBAAExgTheAwiICcTxGkBATCCO1wACYgJxvAa8R0D8kofGa0AsjgACYgJxvAYQEBOI4zWAgJhAHK8BBMQE4ngNWArYrhOwJbjcJ2AJcLtOwJbgcp+AJcDtOgFbgst9ApYAt+sEbAku9wlYAtyuE7AluNwnYAlwu/5MAdtX32ifgFgGAQTEBOJ4DSAgJhDHawABMYE4XgMIiAnE8RrwHAHxl740XgNisQQQEBOI4zWAgJhAHK8BBMQE4ngNICAmEMdrwCDg9PgHAAD//02q/OoAAAAGSURBVAMAeifAATMfnCsAAAAASUVORK5CYII=Questions about this workflow
How do I encode the sample file as a data URI, HTML or CSS?
Download the sample PNG, select the local file and choose data-uri, html or css. The wrappers use the same media-type prefix and Base64 file bytes; a pasted filename or URL is not the image input. The interface accepts its listed raster formats up to 10 MiB, not SVG.
Does Base64 make an image smaller, remove metadata or encrypt it?
No. It retains original bytes and metadata without resizing, compression or encryption. The payload length is 4 × ceil(n/3), before the data URI prefix. The generated HTML has an empty alt attribute; provide appropriate alternative text when the image conveys information.