Base64编码器/解码器

将文本数据编码为Base64格式或解码回原文。

什么是Base64?

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It's commonly used when there's a need to encode binary data that needs to be stored and transferred over media designed to deal with textual data. This encoding helps ensure that the data remains intact without modification during transport.

How Base64 Encoding Works

Base64 encoding takes three bytes of data (24 bits) and represents them as four ASCII characters. Each character represents 6 bits of the original data. The character set includes A-Z, a-z, 0-9, +, and /, with = used for padding when the input isn't a multiple of 3 bytes.

Cron 解析器
  • Embedding images in HTML/CSS using data URIs
  • Encoding email attachments (MIME)
  • Storing complex data in JSON or XML
  • Transmitting binary data over text-only protocols
  • Encoding authentication credentials (Basic Auth)
Examples
输入: Hello, World!
输出: SGVsbG8sIFdvcmxkIQ==
输入: ComUtil
输出: Q29tVXRpbA==
输入: 123456
输出: MTIzNDU2
Frequently Asked Questions

Is Base64 encryption?

No, Base64 is an encoding scheme, not encryption. It doesn't provide any security - anyone can decode Base64 data. For security, use proper encryption algorithms.

Why does Base64 make data larger?

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

Is Base64 URL-safe?

Standard Base64 uses + and / characters which have special meanings in URLs. URL-safe Base64 replaces these with - and _ respectively.