a11y.skipToMainContent
1

图像到 Base64

将一幅图像编码为 Base64 数据 URI ——将其粘贴为 CSS, HTML, 或 JSON. 可选 CSS <code>url (.) </code> 包装.

common.dragImageHere, paste from clipboard (Ctrl+V), or

Preview

Was this tool helpful?
Send Image to:
Advertisement

How to use Image to Base64

  1. 选一相相.
  2. 切换数据:需要前缀和CSS包装.
  3. 复制结果.

{姓名}是什么来着?

Base64-编码图像直接嵌入到HTML或CSS中,避免了额外的HTTP请求. 用于小图标,CSS文件中的背景,或嵌入不允许外部资产的代码中. 注:编码增加~33%的大小——只用于小图像.

Advertisement

FAQ

我什么时候用Base64来做图像?
对于小图像(在~5KB下),否则会通过HTTP加载. 对于更大的图像来说,一个正则图像文件总体速度更快.
Base64 编码会增加文件大小吗 ?
是的, Base64 编码通常使数据大小增加约33%, 所以考虑对负载时间的影响 .
编码过程是私有的吗?
当然,您的图像完全在浏览器中处理;没有数据发送到外部服务器.

Related tools

Author

AR
Aisha Rahmani"The Visual Storyteller"

Design Technologist & Media Specialist

Aisha bridges the gap between pixels and code. With expertise in image processing, SVG optimization, and video compression, she helps creators, designers, and marketers prepare media that looks great and loads fast. She has spoken at design conferences about accessible visual content and has helped agencies reduce page-weight budgets by up to 60 percent without sacrificing creative quality.

Advertisement