完全在浏览器中,将图片转换为 Base64 data URI,以便嵌入 HTML、CSS 或 JSON。
如何使用 图片转 Base64
从你的设备选择一张图片。
复制 data URI,或现成的 CSS 片段。
将其粘贴到你的 HTML、CSS 或 JSON 中。
This image to Base64 converter turns a picture into a data URI, a long text string that embeds the image directly, plus a ready-to-use CSS background snippet. You can inline an image instead of linking to a separate file.
It runs locally in your browser, so your image is read on your device and never uploaded.
A data URI carries the whole image inside the markup, so the browser does not make a separate network request to fetch it. For small assets like icons, that saved round trip can make a page feel faster.
The catch is size and caching. Base64 adds roughly 33 percent overhead because it represents binary data with a limited text alphabet, and an inlined image cannot be cached separately, so it is downloaded again with every page that contains it.
The rule of thumb is to inline small images, icons, tiny logos or a sprite, where avoiding a request is worth the overhead, and to keep larger images as normal files that the browser can cache and load in parallel.
Data URIs work anywhere a URL is accepted: an img src, a CSS background, or a field in JSON or an email template. That makes them handy for self-contained snippets.
常见问题
不会。图片完全在你的浏览器中读取,因此它永远不会离开你的设备。
对于图标等小图片,避免额外网络请求值得换取体积的增加。对于大图片,普通文件更好。
Base64 编码增加约 33% 的开销,因为它用有限的文本字母表表示二进制数据。
嵌入此工具
将此工具添加到你自己的网站。复制下方代码片段即可,它会自动保持最新。
<iframe src="https://monu.tools/embed/zh/image-to-base64" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>相关工具