Image to Base64 Converter
Browser processing — files never leave your device
Encode an image as Base64 and copy it as a raw string, a data URI, an HTML <img> tag or a CSS background rule.
Loading tool…
How to use this tool
- Add an image (any common format).
- Choose the output flavor: raw Base64, data URI, HTML tag or CSS rule.
- Click Copy to put the result on your clipboard.
- Paste it into your code.
About this tool
Base64 encoding turns binary image data into text, letting you embed small images directly in HTML, CSS or JSON without a separate file request. The encoded text is about 33% larger than the binary file, so this technique suits icons and small graphics rather than photographs. The tool outputs the raw Base64, the full data URI with the correct MIME type, and copy-ready HTML and CSS snippets.
Frequently asked questions
- When should I embed images as Base64?
- For small assets (icons, tiny logos) where saving an HTTP request matters, or where external files aren't possible — emails, single-file HTML documents, JSON payloads. Large photos should stay as normal files.
- Why is the Base64 output larger than my image file?
- Base64 represents every 3 bytes of binary data as 4 text characters, adding roughly 33% overhead. That is inherent to the encoding.
- Is my image sent to a server to encode it?
- No. The FileReader API in your browser produces the Base64 string locally.
Related tools
Base64 to ImagePaste Base64 image data — with or without the data URI prefix — to preview it and download it as a normal image file.Base64 TextConvert text to Base64 and back. Unlike naive implementations, this handles UTF-8 correctly, so emoji and non-Latin text round-trip safely.Image CompressorShrink image file sizes by re-encoding at a quality level you control. Works with JPG, PNG and WebP, entirely in your browser.