Base64 Encode Decode Tool
Online Base64 encoding and decoding, supporting text and Base64 format conversion without data upload
Input Content
Result
Instructions
Input Content
Enter the text content to encode or decode in the input box.
Select Operation
Click the "Encode to Base64" or "Decode Base64" button to perform the corresponding operation.
View Result
View the converted content in the result area.
Auxiliary Functions
Use copy, download, swap content and other functions to improve work efficiency.
Base64 Basics
What is Base64?
Base64 is an encoding method that uses 64 printable characters to represent binary data. It is one of the most common encoding methods used on the web to transmit 8-bit bytecode.
The basic principle of Base64 encoding is to encode 3 8-bit bytes (3×8=24 bits) into 4 6-bit bytes (4×6=24 bits), and then map each 6-bit byte to a printable character.
Base64 Application Scenarios
- Embedding binary data (such as images) in URLs, Cookies, and web pages
- Transmitting binary attachments in emails (via MIME protocol)
- Safely transmitting binary data in HTTP environments
- Transmitting non-ASCII characters in text protocols
- Encoding authentication information (such as HTTP Basic Authentication)
Base64 Encoding Table
| Index | Character | Index | Character | Index | Character | Index | Character |
|---|---|---|---|---|---|---|---|
| 0-25 | A-Z | 26-51 | a-z | 52-61 | 0-9 | 62 | + |
| 63 | / | Padding | = |
Encoding Process Example
Take the word "Man" as an example to see the Base64 encoding process:
1. Original text: Man
2. ASCII values: 77 97 110
3. Binary: 01001101 01100001 01101110
4. Group by 6 bits: 010011 010110 000101 101110
5. Convert to decimal: 19 22 5 46
6. Look up Base64 table: T W F u
7. Final Base64 encoding: TWFu
URL-Safe Base64
The "+" and "/" characters used in standard Base64 encoding have special meanings in URLs, so URL-safe Base64 encoding variants have emerged:
- Replace "+" with "-" (minus sign)
- Replace "/" with "_" (underscore)
- Optionally remove padding character "="
Advantages and Disadvantages of Base64
Advantages
- Can convert any binary data to printable characters
- Encoded data can be safely transmitted in text protocols
- Most programming languages have built-in Base64 encoding and decoding functions
- The encoding process is reversible, and the original data can be completely restored
Disadvantages
- Encoded data size increases by approximately 33%
- Not an encryption algorithm, cannot be used for data security protection
- Standard Base64 contains URL special characters and requires additional processing
API开发平台
快速构建、测试和部署API
推荐工具
URL Encoding and Decoding Tool - Online URL Encoding and Decoding
Free Online URL Encoding and Decoding Tool. It supports inputting URLs for encoding and decoding operations, and allows copying the processed results.
Binary Converter - Binary Encoding and Decoding Tool for Text and Files
Online Binary Encoding and Decoding Tool. It supports converting text and files to binary format, or converting binary format back to original text or files.
Hex Converter - Hex Encoding and Decoding Tool for Text and Files
Online Hex Encoding and Decoding Tool. It supports converting text, binary data, decimal numbers, or files to hex format, or converting hex format back to original text or files.
JWT Decoder - Free Online JSON Web Token Parsing Tool
Free Online JWT Decoder Tool. It is used to decode, analyze, and verify JSON Web Tokens, providing detailed information on the header, payload, and signature.
HTML Encoding and Decoding Tool - Online File HTML Encoding and Decoding
Free Online HTML Encoding and Decoding Tool. It supports uploading files for HTML encoding and decoding operations, and allows downloading the processed files.