NHRepon
Home
Services
All ServicesWeb Application DevelopmentMobile Application DevelopmentDigital Marketing and SEO
ProjectsToolsProductsPostsAboutContactLogin
HomeServicesProjectsToolsProductsPostsAboutContact
  • Home
  • Projects
  • Posts
Home/Tools/Image Tools/Base64 to Image
All Tools

Base64 to Image

Paste a data URI or a bare Base64 string and see the image it contains, with the format detected from the bytes, the decoded size reported, and a clear reason when the string is not valid Base64.

Why a Base64 string sometimes will not decode

Base64 has a small alphabet — the letters, the digits, and the two characters + and /, with = used for padding at the end. A copy that introduced a line break, a space or a stray character from a rendered page is no longer valid, and a decoder that silently skipped the offending character would hand you a corrupted file rather than an error. That is why this tool names the character it could not accept instead of guessing, and why it shows the first bytes of the result: a PNG always begins 89 50 4e 47, a JPEG ff d8 ff, a GIF 47 49 46, and a WebP has RIFF in its first four bytes.

The URL-safe variant is a common source of confusion. Some systems replace + with - and / with _ so that a Base64 string can travel through a URL or a filename unchanged. Both forms are accepted here, because the tool normalises them before decoding, and the difference is only in the last two characters of the alphabet. What is not accepted is a string that has been truncated: a valid payload never leaves a single trailing character, and that is reported rather than padded, since padding it would produce the wrong bytes.

The data URI prefix is the other half of the problem. A complete URI is data:, then the MIME type, then an optional ;base64 marker, then a comma, then the payload — so anything before the first comma is metadata and everything after it is data. A string that has a data: prefix but no comma is malformed and is reported as such. A URI without the ;base64 marker is not Base64 at all; it is percent-encoded text, which is legal for SVG and other text formats, and this tool decodes that too rather than pretending it is an error.

What does a Base64 to image decoder do?

A Base64 to image decoder reverses the encoding that turned a picture into text. It reads the string, checks that every character belongs to the Base64 alphabet, converts the characters back into bytes, and hands those bytes to the browser as an image — which is what makes the picture appear on the page rather than in a downloaded file.

The string usually arrives in one of two forms. A complete data URI carries its own metadata: data:, then the MIME type, then a ;base64 marker, then a comma, then the encoded payload. A bare payload is just the encoded characters with no prefix, which is what an API response field or a database column often holds. Both are accepted here, and when the MIME type is missing it is worked out from the bytes themselves.

The useful part is what happens when the string is wrong. Rather than failing silently or producing a corrupted file, the decoder names the character it could not accept, reports a truncated string, or explains that the data: prefix is missing its comma. It also shows the first bytes of the result, which is how the format is identified and how you can see at a glance whether the decode produced a real PNG rather than something that merely claims to be one.

How to decode Base64 into an image

  1. Paste a complete data URI or a bare Base64 string into the box — line breaks and spaces are ignored.
  2. Read the reported MIME type and decoded size, which appear as soon as the string is valid.
  3. Check the preview. If the bytes are not an image, the tool says so instead of showing a broken picture.
  4. Glance at the first bytes if you want to confirm the format by hand — a PNG always begins 89 50 4e 47.
  5. Choose a save format: keep the original bytes, or re-encode through a canvas as PNG, JPG or WebP.
  6. Download the file, or copy the MIME type for pasting into a header or a configuration file.

Base64 to Image limits and rules

Limits, caps and standards referenced by this tool
ItemLimit
Accepted inputA full data URI, a bare Base64 payload, or the URL-safe variant with - and _
WhitespaceSpaces, tabs and line breaks are stripped before decoding
Data URI without ;base64Treated as percent-encoded text, which is how SVG is often carried
Format detectionFrom the MIME type when present, otherwise from the leading bytes
Recognised headersPNG, JPEG, GIF, BMP, WebP, SVG and anything else the browser can render
Save formatsOriginal bytes, or PNG, JPG and WebP through a canvas re-encode
Not coveredEncrypted payloads, and strings that were truncated in transit

When to use it

  • Checking what an API response field actually contains before writing code against it.
  • Recovering a picture from a data URI pasted out of a log, a config file or an email.
  • Confirming that a string copied from a database column is an image rather than a document.
  • Turning an inlined SVG into a saved file that can be opened in an editor.
  • Diagnosing a broken image on a page by decoding the src value it was given.

Is it private?

Decoding happens with JavaScript in this page. The string is never sent anywhere, and the preview is an object URL created locally from the decoded bytes — nothing is uploaded, stored or logged.

Frequently asked questions

Almost always a character that does not belong to the alphabet, or a string that was cut short. A copy from a rendered web page can pick up a stray character or a wrapping line break in the middle of the payload, and some tools truncate a long value when they display it. This decoder names the offending character rather than skipping it, because silently ignoring it would give you a corrupted image instead of an error message.

It is the same encoding with two characters swapped: + becomes - and / becomes _, so that the string can travel through a URL, a filename or a query parameter without being escaped or misread. The two forms are otherwise identical, and this tool normalises the URL-safe one before decoding, so you can paste either. What it will not do is guess at padding, since an incomplete payload produces the wrong bytes.

In two stages. If the string is a data URI, the MIME type after data: is the first answer. If it is a bare payload, or the declared type is a generic application/octet-stream, the leading bytes decide: a PNG begins 89 50 4e 47, a JPEG ff d8 ff, a GIF 47 49 46, a BMP 42 4d and a WebP has RIFF in the first four bytes. That is why the first sixteen bytes are shown — they are the evidence behind the answer.

Only if you ask it to. Keeping the original format writes the decoded bytes exactly as they were, which is the one option that cannot change the picture. Choosing PNG, JPG or WebP draws the image onto a canvas and encodes it again, which is useful when you need a different format or a smaller file, but any re-encode is a fresh generation: a JPG loses a little quality and a format without transparency will flatten it.

Yes. The bytes are decoded and offered for download whatever they are, and the page says plainly that the result is not an image when the MIME type is text/plain, application/pdf or something else. A data URI with no ;base64 marker is handled differently again — it carries percent-encoded text rather than Base64, which is legal and common for SVG, and the decoder reads it as text instead of rejecting it.

Roughly, yes — every four characters stand for three bytes, so the decoded size is about three quarters of the payload length, and that is reported for you. The relationship is not exact because of padding and the prefix, and because a highly compressible image can be large in pixels yet small in bytes. For the actual dimensions, the tool reads them from the decoded image itself and shows the width and height in pixels.

Related tools

  • Image to Base64
  • Base64 Encoder/Decoder
  • Image Converter
  • SVG Converter
  • HTML Viewer

Written and maintained by Md. Nur Hossain Repon.

NHRepon


Md. Nur Hossain Repon expert in NextJS, React, React Native and Flutter. He is a full-stack web and mobile application developer with 5+ years of experience and a passion for building innovative and robust application. Also, he has a strong background in developing high-quality web and mobile applications using the latest technologies and frameworks.
Let's build something amazing together 🚀

Quick Links


  • About
  • Projects
  • Services
  • Contact
  • Posts
  • Products
  • Privacy Policy
  • Terms of Service
  • Tools
  • Smart Life Hubs

Newsletter


We respect your privacy. Unsubscribe anytime.

Connect


© 2026 NHRepon. All rights reserved.

Build v1.5.4+56.73c4a90