Base64 编码器/解码器

编码和解码 Base64 字符串

输入
结果

什么是 Base64?

Base64 是一种二进制到文本的编码方案,以 ASCII 字符串格式表示二进制数据。它通常用于对数据进行编码,以便在只支持文本内容的媒体上传输。

使用案例

- 电子邮件附件 - HTML/CSS 中的数据 URL - API 标记编码 - 在 JSON/XML 中存储二进制数据

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data in ASCII string format. It uses 64 characters (A-Z, a-z, 0-9, +, /) to represent binary data, making it safe for transmission over text-based protocols.

Email Attachments

MIME encoding for email attachments

Data URIs

Embed images directly in HTML/CSS

API Communication

Encode binary data in JSON/XML

Authentication

HTTP Basic Authentication headers

How to Use the Base64 Converter

Text Encoding/Decoding:

  1. Enter your text in the input field
  2. Click "Encode" to convert text to Base64
  3. Click "Decode" to convert Base64 back to text
  4. Use "Swap" to exchange input and output

Image Conversion:

  1. Click "Upload Image" to select an image file
  2. The Base64 data URI will be generated automatically
  3. Paste a Base64 string and click "Preview" to view as image
  4. Copy the Base64 string for use in your code

Frequently Asked Questions

Why use Base64 encoding?

Base64 is essential when you need to transfer binary data through text-based protocols that don't support binary. It's commonly used in emails, data URIs, and API payloads.

Is Base64 encryption?

No, Base64 is encoding, not encryption. It doesn't provide any security - anyone can decode Base64 data. Use proper encryption if security is needed.

Why is Base64 output larger than input?

Base64 encoding increases data size by approximately 33% because it uses 4 characters to represent every 3 bytes of input data.

Is my data secure?

Yes! All encoding and decoding happens locally in your browser. Your data is never sent to any server.

Free Base64 Encoder & Decoder - Encode/Decode Text and Images Online | CatLove Cloud