Image to Base64 Encoder / Decoder
For developers. Turn an image into a base64 string you can paste directly into HTML or CSS — or decode one back to a file.
Drop your image here
JPG, PNG, WebP, SVG — we'll convert it to a base64 data URL.
How to encode an image to base64
Drop your image
Drag in any JPG, PNG or WebP. Or switch to the decode tab and paste a base64 string instead.
Copy the base64 output
The full data URI is shown immediately — ready to paste into your code.
Use it
Paste the data URI into an img src attribute, a CSS background-image, or wherever you need it in your code.
Or decode
Paste a base64 string into the decode tab and get the image back as a downloadable file.
Base64 images: when they help and when they hurt
Base64 encoding is a tradeoff. You eliminate an HTTP request — the browser does not need to fetch a separate file — but the encoded string is about 33% larger than the original binary. For small images like a 2KB icon or a 5KB logo, that is a good deal. You save a round-trip to the server and the added size is negligible.
For large images it flips. A 200KB photo becomes a 266KB base64 string, and that string sits inside your HTML or CSS file. The browser has to parse the entire HTML document before it can start rendering anything, so embedding large images this way delays first paint.
The rule of thumb: base64 for small, frequently-used assets (icons, logos, small decorative elements). URL references for anything bigger, especially above-the-fold hero images where load speed matters most.