Monu Tools

Base64 编码与解码

将文本编码为 Base64,或将 Base64 解码回文本。UTF-8 安全,自动识别方向。

如何使用 Base64 编码

  1. 01

    输入要编码的文本,或粘贴要解码的 Base64。

  2. 02

    点击 Run。方向会自动识别。

  3. 03

    从输出面板复制结果。

What Base64 is

Base64 represents binary or text data using just 64 printable ASCII characters (A-Z, a-z, 0-9, plus + and /), encoding every three bytes as four characters. That keeps data intact when it travels through systems that were built for text rather than raw bytes.

Where you see it

You see it everywhere: data URLs that embed an image directly in HTML or CSS, email attachments (MIME), the header and payload of a JSON Web Token, HTTP Basic authentication headers, and many API fields that need to carry binary data as a plain string.

How this tool handles it

This tool encodes text to Base64 and decodes Base64 back to text, choosing the direction automatically. It is UTF-8 safe, so accents, emoji and other Unicode characters survive the round trip without corruption, which the naive built-in browser functions do not guarantee on their own.

Encoding is not encryption

It is important to know what Base64 is not: it is an encoding, not encryption. Anyone can decode it instantly, so it provides zero security. Never use it to hide passwords, tokens or secrets. Its job is safe transport and representation, not confidentiality.

The size cost

Base64 also has a size cost. The encoded output is about 33 percent larger than the original, because four characters stand in for every three bytes. That trade-off is usually worth it for compatibility, but it is why you would not Base64-encode large files when a real binary channel is available.

Runs in your browser

Everything runs in your browser, so the text you paste is never uploaded. To turn an image file into a Base64 data URL instead of plain text, use the dedicated Image to Base64 tool.

常见问题

自动识别如何工作?

如果你的输入看起来是有效的 Base64 并能解码为可读的 UTF-8 文本,则会被解码;否则会被编码。这覆盖了常见情形,无需手动切换。

对非英文字符安全吗?

安全。编码和解码都是 UTF-8 安全的,因此表情符号、重音符号和其他 Unicode 字符都能正确往返转换。

我能用它保护密码或机密吗?

Base64 是一种编码,而非加密。它可以被轻易还原,不提供任何安全性。切勿用它来保护敏感数据。

来源

嵌入此工具

将此工具添加到你自己的网站。复制下方代码片段即可,它会自动保持最新。

<iframe src="https://monu.tools/embed/zh/base64-encoder" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>

相关工具