图片转 Base64
把图片转成 Base64 数据 URI,方便内嵌进 HTML/CSS 代码。
How to use / 使用步骤
- Upload an image.上传一张图片。
- The tool produces a Base64 data URI — copy it with one click.工具生成 Base64 数据 URI,一键复制。
- Paste it into your HTML, CSS or code.粘贴进 HTML、CSS 或代码中直接使用。
About Image to Base64 Converter / 关于本工具
A Base64 data URI turns an image into a long string of text that can be embedded directly inside HTML, CSS or JSON — no separate image file and no extra network request. Developers use it for tiny icons, email templates, inline SVG fallbacks, or bundling a small image into a single file. Instead of <img src="logo.png"> you write <img src="data:image/png;base64,iVBOR…"> and the picture travels with the markup.
Base64 数据 URI 把图片变成一长串文本,可直接嵌入 HTML、CSS 或 JSON——不需要单独的图片文件,也不产生额外的网络请求。开发者常用它放微型图标、做邮件模板、写内联 SVG 兜底,或把小图打包进单个文件。你不再写 <img src="logo.png">,而是写 <img src="data:image/png;base64,iVBOR…">,图片就随代码一起走了。
When to use it — and when not to / 何时用、何时别用
Base64 strings are about 33% larger than the original file, so they suit small images only. For a 2 KB icon the convenience wins; for a 2 MB photo, the bloated string slows your page and bloats your CSS — link the file normally instead. This tool reads the image locally and never uploads it, so even private images are safe to encode.
Base64 字符串比原文件大约大 33%,因此只适合小图。对 2KB 的图标,便利性占优;对 2MB 的照片,臃肿的字符串会拖慢页面、撑大 CSS——那就照常用文件链接。本工具在本地读取图片、绝不上传,因此私密图片也能放心编码。