🍋 Image Tools
Image to Base64
Encode images as Base64 text for embedding in code.
🍋
Drop
🫸
Squeeze
🍹
Fresh!
🍋
Drop Your Lemons Here
Drag & drop files here
— or —
JPEG
PNG
WebP
GIF
SVG
BMP
⚙️ Squeeze Settings
🍋
About Image to Base64
Convert images to Base64-encoded text strings directly in your browser. Useful for embedding small images in HTML, CSS, JSON, or API payloads without separate file hosting.
How It Works
The file is read using the FileReader API's readAsDataURL method, which produces a Base64-encoded data URI. Optionally, the data URI prefix can be stripped to get raw Base64, and lines can be wrapped at 76 characters for MIME compatibility.
Step by Step
- 1 Upload an image (JPEG, PNG, WebP, GIF, SVG, or BMP)
- 2 Choose whether to include the data URI prefix
- 3 Optionally enable line wrapping for MIME format
- 4 Click Convert to generate the Base64 text
- 5 Download the text file or copy the output
Tips
- Include the data URI prefix for direct use in HTML img src or CSS url().
- Strip the prefix when using Base64 in API payloads or JSON fields.
- Keep images small (< 50 KB) for inline embedding — larger images increase page size.
Frequently Asked Questions
What is the data URI prefix?
It's the 'data:image/png;base64,' part before the actual Base64 data. It tells browsers the data type.
When should I use Base64 encoding?
For small images (icons, logos < 50 KB) embedded in HTML/CSS, or when sending images in JSON APIs.