Base64 编码与解码

即时编码或解码 Base64 与 URL 编码文本,支持 UTF-8、大文本和一键复制。数据不离开你的浏览器。

Mode

What is Base64

Base64 is an encoding scheme that turns arbitrary binary data into 64 safe ASCII characters. It is everywhere: HTTP Basic auth headers, data URLs, email attachments, JWT payloads and countless API transports.

Why encode at all

Base64 is not encryption. It is a transport encoding that makes binary data safe to pass through text-only channels like email headers, JSON strings and URLs.

Common uses

  • HTTP Basic Authentication — Authorization: Basic base64(username:password)
  • Data URLs — data:image/png;base64,iVBORw0...
  • JWT segments — the header and payload of a JSON Web Token
  • Email attachments — MIME Content-Transfer-Encoding: base64

Base64 vs URL encoding

Base64URL encoding
PurposeBinary to textEscape reserved URL characters
Output alphabetA-Z a-z 0-9 + / =%XX hex escapes
Size overhead~33%Varies, 1–3x per char
ReversibleYesYes

Security note

Never use Base64 to hide secrets. It is trivially reversible without a key. For sensitive data, use actual encryption — see our password generator for credential hygiene tips.

常见问题

Is my data uploaded to a server?

No. Encoding and decoding both run in your browser using the built-in btoa and atob functions. Nothing is transmitted.

Can it handle large files?

Yes, though the browser tab will eventually hit its memory limit. For files in the tens of megabytes, command-line tools like base64 are faster.

Is Base64 encryption?

No. It is an encoding with no key, which means anyone can reverse it instantly. Use real encryption if you need confidentiality.

Why did my Base64 decode produce garbled text?

That usually means the input was plain text rather than Base64. Switch the mode selector to encode to go the other way, or check whether whitespace was stripped.

Does it handle UTF-8 characters?

Yes. Multi-byte characters are encoded correctly, so emoji and non-Latin scripts round-trip without corruption.