Base64 Encoder & Decoder Base64 在线编码 / 解码

Encode text or files to Base64, or decode Base64 back — with full UTF-8 Unicode support, so Chinese, emoji and accented characters all survive the round trip. Everything runs in your browser: nothing is uploaded, nothing is stored, no sign-up.

Input 输入: 0 characters 字符 Input size: 0 bytes (UTF-8) Output 输出: 0 characters 字符

How to use it 使用方法

  1. Paste your text, or switch to File modeType or paste plain text in Text mode. To encode a whole file, open the File tab and drop the file in — or paste Base64 there to get a file back.
  2. Click Encode or DecodeEncode turns your input into Base64; Decode turns Base64 back into the original. Turn on URL-safe if the result will go into a web address, a JWT, or a file name.
  3. Copy or download the resultUse Copy result to grab the output, or Download .txt / .b64 to save it as a file. The Swap button moves the output back into the input so you can run it the other way.

FAQ 常见问题

What is Base64? Base64 是什么?

Base64 is a way of writing any bytes — text, images, files — using only 64 safe characters: A–Z, a–z, 0–9, + and /, with = as padding at the end. It exists so binary data can travel through systems that only handle plain text, like email, JSON, and web addresses. It makes data about 33% larger, because every 3 bytes become 4 characters.

Is Base64 encryption? Can I hide secrets with it? 它是加密吗?

No. Base64 is an encoding, not encryption. There is no key and no password — anyone who sees Base64 can decode it instantly, exactly like this page does. Never use Base64 to protect passwords, tokens, or anything private; use real encryption for that.

What is the URL-safe variant for? 网址安全模式有什么用?

Standard Base64 uses + and /, which mean other things inside a URL, and ends with = padding. The URL-safe variant swaps + → - and / → _ and drops the trailing =, so the result can sit inside a web address, a JWT token, or a file name without being escaped. This tool's decoder accepts both variants, padded or not.

Do my files or text leave my browser? 我的文件会上传吗?

Never. Encoding and decoding happen entirely on this page, in your browser, using built-in JavaScript. No file, no text, and no result is sent to any server, and nothing you type is saved or stored. You can disconnect from the internet and the tool still works.

Does it handle Chinese and emoji? 支持中文和表情吗?

Yes. Your text is first converted to UTF-8 bytes and then encoded, so Chinese characters, emoji, and accented letters all round-trip correctly — unlike naive encoders that only handle Latin-1 and break on anything outside it.

Why did decoding fail? 为什么解码失败?

Usually because the input isn't pure Base64: a stray character (a space in the middle of a copied link, a data: prefix from a data URL, or a truncated paste) breaks it. The error message above the result tells you which character is wrong and where. If you pasted a data URL like data:image/png;base64,…, delete everything up to and including the comma first.