Base64 Encode Online

The most flexible Base64 encoder: encode plain text, any local file or a remote URL. You can pick the character set used for text, the Base64 standard (standard, MIME, URL-safe, PEM, IMAP and more) and the output format. Enable live mode to encode as you type.

如何使用 Base64 Encode Online 工具

  1. 选择数据类型:文本、本地文件或远程 URL。
  2. 对于文本,可选择字符编码(默认为 UTF-8,也是大多数系统所期望的编码)。
  3. 选择 Base64 标准和输出格式。
  4. 点击编码为 Base64,然后复制或下载结果。

支持的 Base64 标准

  • 标准(RFC 4648):字母表为 A–Z a–z 0–9 + /,使用 = 填充。
  • MIME(RFC 2045):字母表相同,每 76 个字符以 CRLF 换行。
  • PEM(RFC 7468):每 64 个字符换行,用于证书。
  • Base64URL(RFC 4648 §5):用 - 和 _ 代替 + 和 /,无填充。用于 JWT 和 URL。
  • IMAP(RFC 3501):使用 + 和 ,,无填充。
  • XML 名称令牌(. 和 -)和 XML 标识符(_ 和 :)。
  • OpenPGP ASCII 封装(RFC 4880):每行 76 个字符,并附带 CRC-24 校验和。

为什么字符集很重要?

Base64 编码的是字节,而不是字母。同一个词在 UTF-8、Windows-1252 或 Shift_JIS 中对应的字节不同,因此得到的 Base64 字符串也不同。除非接收方明确要求使用旧编码,否则请使用 UTF-8。

When developers encode to Base64

Use this free Base64 encoder to embed images in CSS/HTML data URIs, put binary blobs in JSON APIs, build HTTP Basic Auth headers, wrap PEM certificates, or produce URL-safe tokens. Prefer Base64URL for JWTs and query strings, and MIME wrapping when a mail client expects 76-character lines.

所有 Base64 编码器

所有 Base64 解码器

常见问题

如何对字符串进行 Base64 编码?

选择“文本”,粘贴字符串,然后点击“编码为 Base64”。默认的 UTF-8 设置与 JavaScript、Python、PHP 和 Java 的输出一致。

可以对文件进行 Base64 编码吗?

可以。选择“本地文件”并选取任意文件:图片、PDF、ZIP、证书等。文件在本地处理,绝不会上传。

Base64 和 Base64URL 有什么区别?

Base64URL 将“+”替换为“-”,将“/”替换为“_”,并且通常省略填充,因此结果无需转义即可用于 URL 和文件名。

Is this Base64 encoder free?

Yes. Encode unlimited text and files in your browser with no sign-up. Nothing you encode is uploaded to our servers.

How do I encode for e-mail (MIME)?

Select the MIME (RFC 2045) standard so the output is wrapped at 76 characters with CRLF, which is what many mail systems expect.

相关工具和指南

评论 (0)

对“Base64 Encode Online”有疑问、想法或发现了 bug?欢迎留言评论、为工具评分或回复他人。

暂无评论,快来分享您的反馈吧!

发表评论

为此工具评分:
Esc
↑ ↓ 移动↵ 打开Esc 关闭