IMG

图片转 Base64

将图片转换为 Base64 数据 URL

🔒 100% client-side — your data never leaves this page
Image Input
🖼Drop image here or click to uploadPNG, JPG, GIF, WebP, SVG supported
Base64 Output
Upload an image to see Base64 output

About this tool

直接在浏览器中将图片文件转换为 Base64 编码。拖拽上传 PNG、JPG、GIF、WebP 或 SVG 文件,即时获得 Base64 字符串、data URL、CSS 背景图片代码或 HTML img 标签。所有处理均在本地完成,图片不会上传到任何服务器。

Frequently Asked Questions

What is Base64 image encoding used for?

Base64 image encoding embeds images directly into HTML, CSS, or JavaScript as text strings, eliminating extra HTTP requests. It's commonly used for small icons, email templates, and offline apps.

Does my image get uploaded to a server?

No. This tool uses the FileReader API to process your image entirely in your browser. Your image data never leaves your device.

Why is the Base64 output larger than the original image?

Base64 encoding increases file size by approximately 33% because it represents binary data using only printable ASCII characters, requiring more characters to encode the same information.

What image formats are supported?

PNG, JPG/JPEG, GIF, WebP, SVG, and most other browser-supported image formats are supported.