Base64 Image Encoder/Decoder & Viewer
Encode images to Base64 data URIs or decode Base64 strings back to viewable images. Supports PNG, JPEG, GIF, SVG, WebP, BMP, and ICO. Get HTML, CSS, and Markdown code snippets. Everything runs locally in your browser.
Image Preview
Code Snippets
HTML <img> Tag
CSS Background Image
Markdown Image
Decoded Image
--Code Snippets
HTML <img> Tag
CSS Background Image
Markdown Image
Base64 Image Encoding & Decoding
Base64 image encoding converts binary image data into an ASCII text string. This data URI format data:image/png;base64,iVBOR... can be embedded directly in HTML, CSS, JavaScript, JSON, or Markdown files without needing a separate image file.
Format auto-detection: When decoding, this tool examines the first bytes of the Base64 string to identify the image format. PNG starts with iVBOR, JPEG with /9j/, GIF with R0lGOD, and SVG with PHN2Zy.
Size comparison: Base64 encoding increases data size by approximately 33% because every 3 bytes of binary data become 4 ASCII characters. For small assets (icons, logos under 5 KB), this trade-off is often worth it to eliminate an extra HTTP request. For larger images, use regular file references instead.