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

All encoding and decoding happens in your browser via FileReader and Canvas. Your images are never uploaded.

☕ 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?
Base64 encoding represents 3 bytes of binary as 4 ASCII characters, so the encoded text is roughly 33% larger than the original file. To shrink it, switch the output format to JPEG or WebP and lower the quality.
Where can I use a Base64 image?
Embed it directly in HTML <img src='data:…'> tags, CSS background-image: url('data:…'), HTML email templates, JSON API payloads, or anywhere you need to ship an image inline without a separate request.
Is decoding safe?
Yes — decoding happens entirely in your browser using a hidden image element. We don't run, log, or upload anything.
Can I batch encode multiple images?
Yes. Drop several images in batch mode to get a table of all results plus a JSON array you can copy in one click.
What's the difference between data URI and raw Base64?
A data URI starts with the mime prefix (data:image/png;base64,…) so browsers know how to interpret it. Raw Base64 is just the encoded payload — useful when the consumer adds the prefix itself.

Related Tools

All 102 Tools

Image CompressorBackground RemoverVideo CompressorImage UpscalerOCR Text ExtractorFormat ConverterImage ResizerEXIF RemoverFace BlurDepth EstimationQR Code GeneratorWatermark MakerColor Palette ExtractorPhoto FiltersImage to PDFObject DetectionImage ClassifierImage CaptionerAI Image GeneratorMeme GeneratorGIF MakerPhoto Collage MakerImage CropPhoto EffectsImage to SVGColor ChangerNoise RemoverPhoto RestorationColor PickerFavicon GeneratorImage to Base64Image Metadata ViewerImage AnnotatorPassport Photo MakerDocument ScannerASCII Art GeneratorImage ComparisonSprite Sheet GeneratorObject RemoverPanorama MakerWord CounterCase ConverterLorem Ipsum GeneratorUUID GeneratorUnix Timestamp ConverterText DiffURL Encoder / DecoderHTML Entity Encoder / DecoderBase64 Text Encoder / DecoderText to Binary / Hex / OctalHash GeneratorJSON Formatter / ValidatorRandom String GeneratorCSV ↔ JSON ConverterMarkdown EditorUnit ConverterPercentage CalculatorBMI CalculatorAge CalculatorTip CalculatorCSS Gradient GeneratorCSS Box Shadow GeneratorCSS Border Radius GeneratorGlassmorphism GeneratorNeumorphism GeneratorCSS Text Shadow GeneratorFlexbox PlaygroundCSS Grid GeneratorAudio TrimmerAudio ConverterAudio MergerAudio RecorderVideo to Audio ExtractorAudio Speed ChangerAudio Volume BoosterRingtone MakerVocal RemoverText to SpeechSpeech to TextAudio Noise RemoverAudio EqualizerAudio EffectsVideo TrimmerVideo MergerVideo ResizerVideo Speed ChangerVideo RotatorVideo to MP4 ConverterAdd Music to VideoMute VideoVideo LooperReverse VideoVideo ScreenshotAdd Subtitles to VideoVideo WatermarkScreen RecorderWebcam RecorderSlideshow MakerVideo FiltersCron Expression BuilderRegex TesterUnix Timestamp Converter