图片转 Base64 — Uttir
Skip to main content

图片转 Base64

将小图片转换为 Base64 数据 URL,可直接粘贴到 HTML 或 CSS 中。

图片转 Base64 — A Base64 data URL embeds an image directly in HTML or CSS, avoiding an extra request. This tool encodes images up to 2 MB and shows the resulting string with its character count so you can judge whether embedding is sensible.

Your image is encoded locally in your browser and never uploaded.

Was 图片转 Base64 useful?

图片转 Base64是什么?

A Base64 data URL embeds an image directly in HTML or CSS, avoiding an extra request. This tool encodes images up to 2 MB and shows the resulting string with its character count so you can judge whether embedding is sensible.

For anything larger, linking a real file is almost always the better choice — Base64 also adds ~33% size overhead.

使用方法

  1. Choose a small image

    Under 2 MB is recommended.

  2. Copy the data URL

    Paste it into a src attribute or CSS url().

示例

Embedding in HTML

The data URL goes straight into the src attribute.

结果: <img src="data:image/png;base64,iVBORw0KGgo…" alt="">

常见问题

相关指南

相关工具

Last reviewed: 2026-11-21