🧰Online Tools

Base64 Encoder/Decoder

Convert between text and Base64 format

Tip: Supports encoding and decoding of Chinese and other Unicode characters

About This Tool

Base64 is an encoding method that represents arbitrary binary data using 64 printable characters. It's commonly used for transmitting binary data in text-only contexts (like email, web pages), or embedding images and files in code. This tool helps you encode regular text to Base64 format, or decode Base64 strings back to original text. It supports Chinese and various Unicode characters, and all processing is done locally in your browser to protect your data privacy.

How to Use

  1. Enter the content you want to encode in the 'Original Text' box (supports Chinese)
  2. Click the 'Encode' button, the Base64 encoded result will appear below
  3. Or paste a Base64 string in the 'Base64 Encoded' box
  4. Click the 'Decode' button, the decoded original text will appear above
  5. Use the 'Copy' button to copy results to clipboard
  6. Click 'Clear' to reset all content

Common Use Cases

  • Email attachments: Convert files to Base64 for embedding in email content
  • Data transmission: Transmit binary data in text-only protocols
  • Image embedding: Convert small images to Base64 for CSS or HTML (Data URL)
  • API debugging: Handle Base64 encoded data in interfaces
  • Configuration files: Store special character data in JSON/YAML configs
  • Web development: Handle encrypted tokens, signatures, and other Base64 format data

FAQ

Q1: What is Base64 encoding?

Base64 is an encoding method that converts arbitrary data to printable ASCII characters. It uses A-Z, a-z, 0-9, and + and / (64 characters total) to represent data. Encoded results are typically about 33% larger than original data, but can be safely transmitted in various text protocols.

Q2: Is Base64 encoding encryption?

No. Base64 is just an encoding method, not encryption. Anyone can easily decode Base64 strings to restore original content. If you need to protect data security, you should use real encryption algorithms (like AES), then Base64 encode the result.

Q3: Why does decoding fail?

Common reasons: 1) The input string is not valid Base64 format; 2) String was truncated or contains extra spaces/newlines; 3) Original data was binary file not text. This tool can only decode Base64 to text, cannot process binary files.

Q4: Why is the encoded Chinese string so long?

Chinese characters use 3-4 bytes each in UTF-8 encoding, and Base64 encoding further increases size. This is normal. For example, '你好' (two characters) takes 6 bytes, Base64 encoded becomes 8 characters.

Q5: What's the difference between Base64URL and standard Base64?

Standard Base64 uses + and / characters, which need escaping in URLs. Base64URL variant uses - and _ instead, making it more suitable for URLs and filenames. This tool uses standard Base64 format.