🔄 Base64 Encoder & Decoder
Encode or decode Base64 text and files instantly. Supports images, PDFs, and any binary file. 100% browser-based Base64 encoder — your data never leaves your device.
How to Use
1
Choose mode
Select Text mode for plain text encoding/decoding, or File mode to encode any file.
2
Enter your input
Type or paste text, then click Encode or Decode. For files, drag and drop or click to browse.
3
Copy the output
Click Copy to copy the Base64 output to your clipboard for use in your project.
Frequently Asked Questions
What is Base64 encoding?
Base64 converts binary data (like images or files) into ASCII text using 64 characters (A–Z, a–z, 0–9, +, /). It's used to embed images in CSS/HTML, transmit data in JSON APIs, and store binary data in text formats.
How do I use Base64 images in CSS?
After encoding an image, copy the output and use it as: background-image: url('data:image/png;base64,YOUR_BASE64_HERE'). This embeds the image directly in your CSS, eliminating an HTTP request.
Is Base64 encoding the same as encryption?
No. Base64 is encoding, not encryption. Anyone can decode Base64 text instantly. Never use it to hide sensitive information.
Why does Base64 encoded text end with == ?
Base64 pads output to a multiple of 4 characters using = signs. One = means 1 padding byte, == means 2 padding bytes.
Can I encode files to Base64?
Yes — switch to File mode, select any file, and the tool instantly shows its Base64 representation. Works for images, PDFs, fonts, and any binary file.
完整指南:Base64编码/解码工具
什么是Base64?
Base64使用64个可打印ASCII字符表示二进制数据。广泛用于:在CSS/HTML中嵌入图片、在JSON API中传输二进制数据、编码HTTP Basic Auth凭证。
Base64不是加密——只是为了在文本系统中安全传输数据。会使数据大小增加约33%。
如何使用
- 选择模式:编码(文本→Base64)或解码(Base64→文本)。
- 粘贴文本或上传文件。
- 结果即时显示在输出面板。
- 使用"URL安全"模式:将
+/替换为-_以用于URL。
专业技巧
- CSS中嵌入图片:
background: url('data:image/png;base64,...')。 - HTTP Basic Auth凭证只是Base64——始终在其上使用HTTPS。
- URL安全的Base64变体省略填充字符
=。