Image to Base64 Converter
Convert images to base64 for embedding in CSS, HTML, and API payloads. Decode base64 back to images. Get data URL, CSS snippet, HTML img tag, or raw base64. Files never leave your device.
Drop an image to encode
or click to browse ยท JPEG, PNG, WebP, GIF, SVG supported
How to convert images to base64
- 1Upload or paste base64
Drop an image to encode it, or switch to decode mode and paste a base64 string. Supports JPEG, PNG, WebP, GIF, and SVG.
- 2Choose output format
Select Raw Base64, Data URL, CSS background-image, HTML img tag, or JSON. Each format is ready to paste into your code.
- 3Copy or download
Copy the encoded string with one click or download as a text file. In decode mode, preview and download the decoded image.
What is base64 image encoding and when should you use it?
Base64 encodes binary image data as ASCII text, allowing images to be embedded directly in CSS, HTML, JSON, and API payloads without separate file hosting. The main use cases are small icons and UI elements in CSS (eliminating an HTTP request per image), images in HTML email templates (where external image hosting is unreliable), and API integrations that expect base64-encoded image data. The trade-off is that base64 strings are always 33% larger than the original binary, so this approach is not suitable for large images or performance-critical web pages where file size and caching matter.
Base64 size overhead and performance considerations
Every 3 bytes of binary data become 4 ASCII characters in base64, producing a consistent 33% size increase. A 10KB icon becomes approximately 13.3KB in base64. For small assets this is negligible, but for a 500KB photo the base64 string would be 667KB of text embedded in your HTML or CSS file. This prevents the browser from caching the image separately, blocks parallel downloading, and inflates the size of the containing document. The general rule: use base64 for assets under 10KB and regular image files for everything else.
Get GEO & AEO tips every week
The Layman SEO newsletter. Plain English updates on what is changing in search - SEO, AEO, and GEO - and what to do about it. One email a week. Unsubscribe any time.
No spam. No paywall content. Unsubscribe with one click.