Base64 to Image Converter
Paste a Base64 string or data URI. Preview the image instantly and download it. Auto-detects format.
How to Decode a Base64 Image
- Paste the string — either a full data URI (
data:image/png;base64,...) or a raw Base64 string. - Preview loads instantly — the image renders in the preview box. Format, dimensions, and file sizes are shown.
- Download — click Download to save the image file. Choose a specific format in the dropdown to convert it.
- Copy data URI — use the Copy Data URI button if you need to re-embed the image elsewhere.
Understanding Base64 Image Data
Base64 encoding converts binary image data into a string of printable ASCII characters. This makes it possible to embed images in HTML, CSS, JSON, API responses, and any text-based format. The reverse process — decoding Base64 back to an image — is equally common. Developers encounter Base64 images when working with REST APIs that return embedded thumbnails, database records that store images as text, email HTML templates, JSON configuration files, and browser localStorage or IndexedDB.
Data URI Format
A complete data URI has three parts separated by commas and colons: the scheme (data:), the media type with encoding (image/png;base64), and the encoded data. The media type tells the browser what kind of data follows. When you paste a data URI into this tool, the MIME type is extracted from the prefix to ensure the downloaded file has the correct extension and format.
Raw Base64 Without a Data URI Prefix
Sometimes you have just the raw Base64 string without the data:image/... prefix. This happens when working with APIs, databases, or tools that store only the encoded bytes. In this case, this tool reads the first few decoded bytes (called magic bytes or file signatures) to identify the format: PNG files start with \x89PNG, JPEG files start with \xFF\xD8\xFF, GIF files start with GIF87a or GIF89a, and WebP files start with RIFF...WEBP.
Downloading in a Different Format
The download format selector lets you convert the image to PNG, JPEG, or WebP on download. This works by drawing the decoded image onto an HTML canvas element and then exporting the canvas in the desired format. Note that converting to JPEG will lose any transparency channel — transparent pixels become white on a JPEG background. PNG and WebP both support transparency.
Common Base64 Issues
The most common problem with Base64 strings is extra whitespace — line breaks, spaces, and tabs are not valid Base64 characters and will cause decoding to fail. This tool automatically strips whitespace before attempting to decode. Another common issue is truncated Base64 strings: if the original image was cut off during copying or transmission, the decoded result will be corrupt. The tool validates the decoded data by attempting to load it as an image and will show an error if the image fails to load.