Data URI / Base64 To Image Converter
Turn a Data URI or raw Base64 string back into a previewable, downloadable image. Choose the MIME type, add an optional file name and check the decoded dimensions.
Decoding is local, but an image from an untrusted source is still untrusted. The current build has a duplicate paste control, so paste directly into the textarea.
Sử dụng Data URI / Base64 To Image Converter
Base64 / Data URI → Hình ảnh
Đọc nội dung
Data URI / Base64 to Image
What a Data URI image is
A Data URI packs an image into a text string. It starts with data:, then a media type such as image/png, then a base64 marker and the encoded bytes. Browsers can display that string directly in an image tag, which is why small icons sometimes appear inside HTML or CSS without a separate file. This page goes the other way: it takes a Data URI or a raw Base64 string and turns it back into a preview and a downloadable image.
Raw Base64 versus a full Data URI
A full Data URI contains the media type, so the page can infer the format. A raw Base64 string contains only the payload, so you must choose the correct MIME type yourself. If you choose PNG for JPEG bytes, the preview may fail or the downloaded file may not open in some applications. If you are unsure, inspect the first characters of the decoded data or ask the person who supplied the string for the original media type.
How to convert the string
Paste the Data URI or raw Base64 into the textarea. Choose the matching MIME type from the list: PNG, JPEG, WebP, GIF, SVG, BMP or AVIF. Optionally enter a file name without a path. Press convert. The page decodes the payload, shows an image preview, reports the width and height, regenerates a clean Data URI and estimates the byte size. Use the download button to save the image.
Choosing the right MIME type
The type must match the actual bytes, not the file extension you want. A JPEG normally starts with bytes that identify JFIF or Exif, while a PNG starts with a characteristic signature. SVG is text-based XML, not a bitmap. AVIF support depends on the browser's decoder. If the preview is blank, try the other likely type, but do not keep guessing blindly; a wrong label can produce a file that opens in one program and fails in another.
Preview, dimensions and file name
The preview is rendered by the browser. The width and height come from the decoded image, so they are a useful check that the string contains the image you expected. The optional file name is used for the download; the extension is added from the selected MIME type. Keep the name short and avoid slashes, quotes and control characters. The page does not upload the file, rename it on a server or create a permanent link.
Supported formats and browser limits
The menu covers common web formats, but support is ultimately browser-dependent. PNG, JPEG, GIF and WebP are widely supported. SVG previews as an image and may be restricted by browser security rules. BMP is large but usually readable. AVIF needs a modern browser with an AVIF decoder. There is no explicit size cap, but a very large Base64 string can freeze the tab because the whole value is held in memory. Split or compress huge images before pasting.
Why the preview can fail
A blank preview usually means the Base64 is truncated, contains whitespace or line breaks that were not cleaned, uses an unexpected alphabet, or is labelled with the wrong MIME type. A Data URI copied from a chat app may have lost characters. A string copied from a database may include escaped quotes. If the page reports an image error, re-copy the full value and confirm that it begins with a valid data: prefix or a clean Base64 payload.
The paste button issue
The page has more than one control with the same paste identifier, so the settings-area paste action can do nothing in the current build. Paste directly into the textarea with the keyboard or the browser's context menu. The main convert, clear, copy and download buttons are the reliable path. If a button appears unresponsive, try the keyboard shortcut or paste manually rather than assuming the image is invalid.
Security and privacy
Decoding runs in your browser, so the string is not sent to Newisty. That does not make an unknown image safe. SVG can contain scripts or external references, and a downloaded file can be malicious regardless of its extension. Treat images from untrusted sources with caution, open them in a sandboxed viewer if necessary, and do not run an SVG as a script. Clear the textarea when you are done if the content is sensitive.
When this is useful
It is handy for recovering a small image from an HTML email, a CSS file, a JSON API response or a database dump. It can also help you inspect a Data URI before embedding it in a page. It is not a batch converter, an image editor or a compression tool. If you need to resize, crop or reduce the file size, decode the image first and use an image editor, then re-encode it.
Common problems
If the downloaded file will not open, check the selected MIME type and the first bytes of the payload. If the dimensions are wrong, you may have decoded a different image than you expected. If the textarea rejects a very long string, the browser may be hitting a memory limit. If the file name has no extension, add one manually only after confirming the real format. If the Data URI contains a charset parameter, the decoder may still accept it, but the media type must be correct.
What not to do
Do not paste a production secret or a private photo into a public page without checking how it is handled. Do not trust the MIME type alone as a security check. Do not use this page to edit, resize or compress an image. Do not assume a decoded SVG is harmless. Do not strip characters from a Base64 string to make it fit; a truncated payload will not decode correctly.
Frequently Asked Questions
Câu hỏi thường gặp
Bình luận (0)
Hãy mô tả vấn đề mà bạn gặp phải để chúng tôi có thể tìm hiểu và cải thiện công cụ này.