Signature detectionDimensions & byte sizeNo upload needed

Base64 to Image Converter

Paste raw Base64 or a full data: URI to preview the image, confirm its real format from the decoded bytes, and download the file.

Base64 decoder

Decode Base64 into a viewable image

Paste a raw Base64 payload or a full data: URI. The image type is detected from the decoded bytes, not from the header text, so a mislabelled Data URI is still identified correctly.

Detected type
Decoded size
Dimensions
Base64 overhead
InputBase64 or Data URI
OutputDecoded image


The decoded image appears here.

Decoding runs in your browser with atob(); the payload is not uploaded to a server.

Load sampleTry a decodable payload

What is a Base64 image?

Base64 represents binary data using printable text characters. Standard Base64 uses A–Z, a–z, 0–9, +, and /, with = sometimes added at the end as padding.

Images are binary files, so Base64 can represent their bytes as text for use in places such as JSON responses, HTML, CSS, email MIME content, or configuration files.

This tool performs the reverse operation. It decodes the Base64 text back into bytes, checks whether those bytes contain a supported image, and shows a preview when the browser can render the result.

Raw Base64 vs a Data URI

Base64 image data commonly appears in two forms.

Raw Base64 contains only the encoded payload:

iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAAB…

A Base64 Data URI also includes information about the data type:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAAB…

In this example, data: identifies a Data URI, image/png is the declared MIME type, and ;base64 says that the content after the comma is Base64 encoded.

If both raw Base64 and Data URIs are supported by the tool, either form can be pasted into the input. The actual decoded bytes are more reliable for identifying the file format than the MIME type written in the Data URI.

How to decode a Base64 image

  1. Paste the Base64 image data Enter the raw Base64 payload or a supported data:image/...;base64,... Data URI.
  2. Check the detected image type The decoded bytes can be inspected for known file signatures such as PNG, JPEG, GIF, WebP, AVIF, or BMP.
  3. Preview the image If the decoded data is a valid browser-supported image, the preview shows the image and its pixel dimensions.
  4. Download or copy the result Download the decoded image when supported, or copy the cleaned Base64 or generated Data URI for reuse elsewhere.

How image format detection works

Many image formats contain recognizable byte patterns near the beginning of the file. These are commonly called file signatures or magic numbers.

Format Typical identifying bytes Common Base64 prefix
PNG 89 50 4E 47 0D 0A 1A 0A iVBORw0KGgo
JPEG FF D8 FF /9j/
GIF 47 49 46 38 followed by the GIF version Often R0lGOD
WebP RIFF container with WEBP identifier Often UklGR
AVIF ISO Base Media File Format containing an AVIF-compatible ftyp brand Varies by file structure
BMP 42 4D (BM) Often Qk
SVG Text-based XML/SVG markup rather than a binary magic number Often starts with Base64 representing <svg or XML markup

Prefixes can be useful clues, but format detection should rely on the decoded file structure rather than assuming that every file of a given type starts with one exact Base64 string.

Base64 increases file size instead of compressing it

Base64 converts each group of 3 input bytes into 4 encoded characters. For sufficiently large inputs, this means the encoded representation is usually about one-third larger than the original binary data.

Original data Base64 length Approximate increase
1,024 bytes 1,368 characters 33.6%
48 KiB 65,536 characters 33.3%
2 MiB About 2.8 million characters About 33.3%

Small inputs can have slightly higher percentage overhead because Base64 output is padded to groups of four characters.

This is why Base64 is normally used to make binary data easier to transport inside text-oriented formats rather than to reduce file size. Large photographs and other media are usually better served as normal files instead of being embedded directly as Base64 strings.

Why a Base64 image may fail to decode

  • The Base64 data is incomplete. A Base64 payload with an impossible length may have been truncated while being copied from a log, API response, terminal, or application output.
  • The string contains invalid characters. HTML markup, quotes, commas, or other surrounding text may accidentally become part of the Base64 payload.
  • The Base64 is valid but the data is not an image. Base64 can represent any bytes, including PDFs, ZIP archives, fonts, audio files, or plain text.
  • The Data URI is not Base64 encoded. A value such as data:image/svg+xml,%3Csvg... uses percent encoding instead of Base64. The URL Encoder & Decoder is more appropriate for decoding that payload.
  • The image itself is corrupt or incomplete. The beginning of a file may still contain a recognizable image signature even when later bytes are missing, so detection can succeed while the browser cannot render the image.
  • The data has been encoded more than once. A Base64 string may decode into another Base64 string or into an entire data:image/...;base64,... value when an application accidentally encoded the content twice.

Useful Base64 image decoding examples and practical use cases

  • Inspect an API response: Decode an image returned inside a JSON field to verify what an application or service actually produced.
  • Recover an inline CSS image: Extract the payload from a background-image: url(data:image/...) declaration and save it as an image file.
  • Check a MIME type mismatch: Compare the type declared by a Data URI with the format indicated by the decoded file bytes.
  • Check image dimensions: Preview an encoded logo, avatar, icon, or screenshot and confirm its pixel width and height.
  • Inspect email MIME content: Email attachments and inline images may use Base64 transfer encoding. Extracting the encoded body lets you inspect the underlying file.
  • Review inline assets: Decode image data found in source code, configuration files, generated HTML, or application logs.

Need the opposite workflow? Image to Base64 converts an image file into Base64, while the Base64 Encoder & Decoder handles general Base64 text encoding and decoding.

Base64 images and browser caching

A normal image URL can be requested and cached as a separate resource. An image embedded directly inside HTML or CSS as a Data URI becomes part of that containing document or stylesheet instead.

This can be convenient for very small assets because it avoids an additional resource request, but it also increases the size of the containing file. For larger images, a normal image file is usually easier to cache, update, and reuse.

Browser-based processing and privacy

Base64 image decoding and preview generation run in your browser and do not require the image payload to be uploaded to TryFormatter's server for conversion.

Remember: Base64 is not encryption. Anyone who has access to the encoded string can decode the underlying image, so Base64 data should be protected in the same way as the original file when it contains private information.

Frequently Asked Questions

Do I need the data:image/png;base64, prefix?

Not necessarily. If raw Base64 input is supported, the image format can be determined from the decoded bytes. A Data URI prefix is useful when the encoded image needs to be embedded directly in HTML, CSS, or another format that accepts Data URIs.

Why does the detected image type differ from the Data URI type?

The MIME type in a Data URI is declared as text and can be incorrect. Inspecting the decoded file signature provides a stronger indication of the actual image format. For example, bytes beginning with FF D8 FF indicate a JPEG even if the Data URI says image/png.

Why can a Base64 image be detected but still fail to preview?

The beginning of the decoded data may contain a valid image signature while later parts of the file are missing or corrupt. In that situation the format can sometimes be recognized even though the browser cannot render the complete image.

Can I decode an SVG Data URI?

A Base64-encoded SVG can be decoded like other Base64 data when the tool supports SVG. Many SVG Data URIs instead use percent encoding, such as data:image/svg+xml,%3Csvg.... Those values need URL or percent decoding rather than Base64 decoding.

Does Base64 decoding reduce image quality?

No. Base64 decoding itself is lossless because it reconstructs the encoded bytes. Any image quality loss normally happens when the image is originally compressed or converted to a lossy format such as JPEG.

Why is Base64 larger than the original image?

Base64 represents every 3 input bytes using 4 text characters, so large Base64 values are typically about one-third larger than the original binary data. Base64 is designed for text-safe representation, not compression.

Is a Base64 image private or encrypted?

No. Base64 is only an encoding format. Anyone who can access the Base64 string can decode the image without a password or secret key.