Conversion
图像转 Base64
将图像编码为 Base64 / Data URI,并将 Base64 解码回图像--即时,在您的浏览器中。
Your files stay on your device - processed locally via WebAssembly, never uploaded
Drop images to encode
JPEG, PNG, WebP, GIF, BMP, SVG - single or batch
Embed this tool on your website
Copy this code to add the 图像转 Base64 to your site for free. It runs entirely in your visitors' browsers - no API key, no usage limits.
<iframe src="https://optipix.art/embed/image-to-base64" width="100%" height="600" style="border:1px solid #e4e4e7;border-radius:8px;" title="图像转 Base64 by OptiPix" loading="lazy"></iframe> <p style="font-size:12px">Free tool by <a href="https://optipix.art/image-to-base64">OptiPix 图像转 Base64</a></p>
❤️ Love this tool? Support our team.
No ads, no tracking, no limits. Tips keep 104 tools free for everyone.
Secure payment via Stripe · No account needed
About 图像转 Base64
Last updated: May 2026
OptiPix 图片转 Base64 可将任何图片转换为 Base64 数据 URI,您可以直接将其嵌入 HTML、CSS、JSON 或 API 中 - 并且可以将 Base64 字符串解码回可下载的图片。拖放 JPEG、PNG、WebP、GIF、BMP 或 SVG,即可立即看到完整的数据 URI、原始 Base64 字符串、字符数、原始大小与编码大小的对比,以及可直接粘贴的 HTML / CSS 代码片段。重新编码为 PNG、JPEG(带质量控制)或 WebP,以找到最小的 Base64 表示形式。将任何 Base64 字符串粘贴回解码器,即可预览并下载原始图片。批量模式可让您一次编码多张图片,并将它们全部复制为 JSON 数组。所有操作均在本地运行 - 文件使用 FileReader 读取,绝不上传。
How It Works
编码使用 FileReader.readAsDataURL 实现即时 Base64,并可选地通过 canvas 重新编码来切换格式。解码将数据 URI 加载到 Image 对象中,将其绘制到 canvas 上,然后导出为可下载的 Blob。
Use Cases
- •在 CSS 中嵌入小型图标以节省 HTTP 请求
- •在需要离线渲染的 HTML 邮件中嵌入图片
- •将图片发送到期望在 JSON 中接收 Base64 的 API
- •解码您在 webhook 中收到的 Base64 blob
- •通过将图片重新编码为 WebP 来减小 Base64 字符串的大小
You Might Also Like
If you find 图像转 Base64 useful, check out these related tools: Format Converter, Image Compressor, and Image to SVG. All tools run entirely in your browser with no uploads or signups required.
Explore more: Browse all tools · Step-by-step guides · Tips & tutorials · Compare tools