Base64图像预览与解码器
预览Base64编码的图像并将其解码为干净的数据URI。粘贴原始Base64或完整的data:image/...;base64字符串——查看渲染后的图像以及检测到的格式、MIME类型和解码后的文件大小。
输入
粘贴的字符串中的空格和换行会被自动忽略。
仅当输入是没有data:image/...;base64,前缀的原始Base64,且文件的签名无法自动检测其真实格式时使用。
输出
粘贴Base64图像后,预览将显示在此处。
经过清理、可直接使用的URI数据——粘贴到<img src>或CSS的url()中。
| 属性 | 值 |
|---|---|
| No data yet | |
使用指南
What this tool does
Paste a base64-encoded image and see it rendered instantly — no guessing whether the string is valid, no need to build your own <img> tag just to check. It accepts raw base64 (just the encoded bytes) or a full data:image/...;base64,... URI, cleans up whatever whitespace or line wrapping got added when it was copied, and shows you the decoded image alongside its format, MIME type and file size.
How to use it
- Paste the base64 string into the input. Line breaks and spaces are stripped automatically, so a value copied from an email, a log line or a multi-line text file still works.
- If the string doesn't already start with
data:, pick the image type — PNG, JPEG, GIF, WebP or SVG. This is only a fallback: if the actual file signature can be recognized, the tool trusts the bytes over your selection. - The preview, decoded info table and a normalized data URI appear immediately — there's no button to press.
- Use the preview's Download action to save the decoded file, or copy the normalized data URI to paste straight into an
<img src>or a CSSurl().
Why the preview sometimes shows a different format than you picked
The tool reads the first few bytes of the decoded data (the file's "magic number") to identify PNG, JPEG, GIF, WebP and SVG content. If it recognizes a signature, that wins over the image-type dropdown or a mismatched data: MIME prefix — so a .png-named string that's actually a JPEG still renders and downloads correctly. The dropdown only matters when the bytes don't match any known signature.
Why there are no pixel dimensions
Reading an image's width and height requires the browser to actually decode and lay out the image (an Image/<canvas> element), which happens after this tool has already done its job of validating and previewing the string. What you get here — format, MIME type, decoded byte size and base64 length — is everything derivable straight from the encoded string itself.
Is my data private?
Yes. Decoding happens entirely in your browser — the base64 string, and the image it represents, are never uploaded or logged anywhere.
Common uses
- Sanity-checking a base64 image before pasting it into HTML, CSS or an API payload.
- Recovering a viewable, downloadable file from a base64 blob found in a log, database dump, or JSON response.
- Confirming that a
data:URI you copied is well-formed and points to the format you expect.
Use it from code
From 3 credits per callREST API
curl -X POST https://api.iotools.cloud/v1/tool/base64-image-preview-decoder \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"base64Input": "R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",
"mimeType": "image/png"
}'Swap in your own key from your account. The tool's fields are the body — no wrapper.
Ask an AI agent
Use the IOTools `base64-image-preview-decoder` tool (Base64 Image Preview & Decoder) on this input:
YOUR_INPUT_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.