跳转到主要内容

Base64 编解码工具

在浏览器中即时将文本或二进制数据编码为 Base64,或将 Base64 字符串解码为纯文本。

Input
0 chars | 0 bytes
Encode
Output
0 chars | 0 bytes

Base64 encoding is the go-to solution whenever you need to transmit binary data through a channel designed for text. Whether you are embedding images directly in CSS, passing authentication credentials in an HTTP header, or storing binary blobs in JSON payloads, Base64 gives you a reliable, universally understood encoding that survives every text-safe transport layer intact.

Developers reach for Base64 constantly — in JWTs, data URIs, MIME email attachments, and environment variables that carry certificates or keys. This tool lets you encode any UTF-8 string or paste a Base64 string and decode it instantly, so you can inspect tokens, debug API payloads, and verify encoded assets without leaving the browser.

如何在线进行 Base64 编解码

  1. 1

    粘贴您的输入内容

    将纯文本或 Base64 字符串粘贴到输入面板中,选择编码或解码。

  2. 2

    即时获取结果

    编码或解码输出立即显示。工具验证输入,并报告任何无效 Base64 字符的确切位置。

  3. 3

    复制输出

    将结果复制到剪贴板。支持标准 Base64(RFC 4648)和 URL 安全 Base64 变体。

How Base64 Encoding Works

Base64 works by splitting the input byte stream into 6-bit groups rather than the usual 8-bit bytes. Each 6-bit value maps to one of 64 printable ASCII characters — the uppercase and lowercase Latin alphabet, the digits 0–9, and the two symbols `+` and `/`. Because 6 bits fit into one character and 8 bits make one byte, every 3 bytes of input produce exactly 4 Base64 characters, expanding the data by roughly 33%.

When the input length is not a multiple of three, padding characters (`=`) are appended to keep the output length a multiple of four. URL-safe Base64 replaces `+` with `-` and `/` with `_` to avoid conflicts in query strings and filenames — important to know when decoding tokens from OAuth or JWT sources.

为什么使用 FileCrank Base64 编解码工具?

  • ✓ 支持标准 Base64(RFC 4648)和 URL 安全 Base64。
  • ✓ 验证输入并以位置信息高亮显示无效字符。
  • ✓ 处理文本和二进制数据的表示。
  • ✓ 完全在浏览器中运行——不向任何服务器发送数据。

功能与规格

最大文件大小
最大 100 MB
隐私
文件在约一小时后删除
价格
免费,无需注册
处理方式
100%客户端
编码标准
RFC 4648 — URL-safe variant supported
剪贴板支持
One-click copy to clipboard
您的数据永不离开浏览器——所有处理均在本地完成。无需注册账户。免费使用,无限制。

常见问题

Base64 编码有什么用途?

Base64 用于在 JSON、HTML、XML 和电子邮件等文本格式中嵌入二进制数据(图片、字体、文件)。它将每 3 个字节编码为 4 个 ASCII 字符,使大小增加约 33%。

标准 Base64 和 URL 安全 Base64 有什么区别?

标准 Base64 使用在 URL 中有特殊含义的 + 和 / 字符。URL 安全 Base64 将它们替换为 - 和 _,使输出可在查询字符串和文件名中使用,无需百分比编码。

为什么我解码的 Base64 输出看起来乱码?

输入可能是二进制数据(图片或文件),而不是 UTF-8 文本字符串。Base64 编码的二进制数据解码后仍是二进制字节。如果您期望得到可读文本,原始编码器可能编码了一个非文本文件。

此处 Base64 编码有大小限制吗?

工具可处理达到显示限制的输入。对于更大的文件,在浏览器中进行 Base64 编码在几兆字节以内是实用的,超出后内存限制会变得相关。

Base64 vs. Hex Encoding vs. Compression

Hex encoding is simpler — each byte becomes two hex digits — but it doubles the data size instead of adding only 33%. Base85 and Base91 are more compact than Base64 but far less universally supported. If size is the concern and both ends control the codec, consider zlib or gzip compression before encoding. Base64 wins on compatibility: every standard library in every language ships a Base64 codec, making it the safest default for interoperability.

FileCrank Base64 编解码工具在文本和二进制数据与 Base64 格式之间转换,支持 RFC 4648 和 URL 安全变体,完全在浏览器中运行。

Advertisement

Ad