图片转 Base64 在线工具

上传图片,即时获取 Base64 编码字符串或 Data URL。

点击或拖拽图片到此处

支持 PNG、JPEG、GIF、WebP、SVG、BMP

What Is Image to Base64 Converter?

Image to Base64 Converter is a free online tool that encodes any image file into a Base64 string or data URL. The encoded output can be embedded directly into HTML, CSS, or JSON — eliminating the need for a separate image file. It is commonly used for embedding small icons, logos, and thumbnails in web pages and API payloads.

How to Use Image to Base64 Converter

  1. Click the drop zone or drag and drop an image file onto it.
  2. The tool instantly encodes the image and displays both the full data URL and the Base64-only string.
  3. Click Copy next to either output to copy it to your clipboard.

Features

  • Supports PNG, JPEG, GIF, WebP, SVG, BMP, and more
  • Outputs both full data URL and Base64-only string
  • Drag-and-drop or click-to-upload interface
  • Image preview with file name and size
  • Runs entirely in your browser — zero data uploaded

FAQ

What image formats are supported?

The tool supports all common image formats including PNG, JPEG, GIF, WebP, SVG, and BMP.

What is the difference between a data URL and Base64?

A data URL includes the MIME type prefix (e.g. data:image/png;base64,...) and can be used directly in HTML img src or CSS background-image. The Base64-only string is just the encoded data without the prefix.

Is my image uploaded to a server?

No. The image is read and encoded entirely in your browser using the FileReader API. Your image never leaves your device.