Image to Base64
Turn an image into a Base64 data URL you can paste into CSS or HTML.
The file is read locally and shown as a data URL you can paste into CSS or HTML.
File
Worked example
A small PNG becomes a data URL that starts with data:image/png;base64, followed by the encoded bytes. Paste that into CSS or an img src and you're done.
FAQ
- Is Base64 smaller?
- No. It's about a third larger than the file. It's useful for embedding, not for saving space.
- Should I embed a large photo this way?
- Usually no. A data URL of a big image makes the page heavier and harder to cache.
- Does the file leave the browser?
- No. The FileReader builds the data URL locally.