Conversion
Image to Base64
Encode images to Base64 / Data URI and decode Base64 back to images — instantly, in your browser.
Drop images to encode
JPEG, PNG, WebP, GIF, BMP, SVG — single or batch
☕ Love this tool? Support the developer.
100% free — no ads, no limits. Your support keeps every tool free.
Secure payment via Stripe · No account needed
About Image to Base64
OptiPix Image to Base64 converts any image into a Base64 data URI you can embed directly in HTML, CSS, JSON, or APIs — and decodes Base64 strings back into downloadable images. Drop a JPEG, PNG, WebP, GIF, BMP, or SVG and instantly see the full data URI, the raw Base64 string, character count, original size vs encoded size, and ready-to-paste HTML / CSS snippets. Re-encode as PNG, JPEG (with quality control), or WebP to find the smallest possible Base64 representation. Paste any Base64 string back into the decoder to preview and download the original image. Batch mode lets you encode many images at once and copy them all as a JSON array. Everything runs locally — files are read with FileReader and never uploaded.
How It Works
Encoding uses FileReader.readAsDataURL for instant Base64, with optional canvas re-encoding to switch format. Decoding loads the data URI into an Image, draws it onto a canvas, and exports as a downloadable Blob.
Use Cases
- •Inline a small icon in CSS to save an HTTP request
- •Embed images in an HTML email that needs to render offline
- •Send an image to an API expecting Base64 in JSON
- •Decode a Base64 blob you received in a webhook
- •Reduce a Base64 string by re-encoding the image as WebP
Frequently Asked Questions
Why is the Base64 string bigger than the original file?
Where can I use a Base64 image?
Is decoding safe?
Can I batch encode multiple images?
What's the difference between data URI and raw Base64?
Related Tools
Format Converter
Convert images between JPEG, PNG, WebP, and more.
Image Compressor
Compress images up to 90% smaller without visible quality loss.
Image to SVG
Vectorize raster images into scalable SVG with potrace-style tracing.
Base64 Text Encoder / Decoder
Encode text to Base64 and decode Base64 back to text. URL-safe mode available.