Features
| Operation | Description |
|---|---|
| decode | Decode Base64 strings to text/JSON/binary |
| encode | Encode text/files to Base64 |
| detect | Automatically detect Base64 content type (JSON/text/image/PDF, etc.) |
| batch | Batch decode multiple Base64 strings |
Usage
Important: Always use the -p parameter to get human-friendly output format!
1. Decode Base64
# 解码并显示完整内容(推荐)
python3 .blade/skills/base64-parser/scripts/base64_tool.py -p decode "SGVsbG8gV29ybGQ="
# 解码并保存到文件
python3 .blade/skills/base64-parser/scripts/base64_tool.py -p decode "..." --output result.txt
# 解码二进制(如图片)并保存
python3 .blade/skills/base64-parser/scripts/base64_tool.py -p decode "iVBORw0KGgo..." --output image.png --binary
2. Encode to Base64
# 编码文本
python3 .blade/skills/base64-parser/scripts/base64_tool.py -p encode "Hello World"
# 编码文件
python3 .blade/skills/base64-parser/scripts/base64_tool.py -p encode --file image.png
# URL 安全编码
python3 .blade/skills/base64-parser/scripts/base64_tool.py -p encode "Hello World" --url-safe
3. Detect Type
# 自动检测 Base64 内容类型并显示内容
python3 .blade/skills/base64-parser/scripts/base64_tool.py -p detect "eyJ0ZXN0IjogMX0="
4. Batch Processing
# 从文件批量解码(每行一个 Base64)
python3 .blade/skills/base64-parser/scripts/base64_tool.py -p batch --file input.txt --output-dir ./decoded/
Output Format Description
-p(pretty): Human-friendly format, with emoji icons, displays the complete decoded content- Without
-p: JSON format, suitable for program processing
Example Output (using -p):
✅ Successfully decoded as JSON
📊 类型: json (application/json)
📏 大小: 35 bytes
📄 解码内容:
--------------------------------------------------
{
"name": "Blade",
"version": "2.0"
}
--------------------------------------------------
Supported Formats
| Format | Auto-detect | Description |
|---|---|---|
| JSON | ✅ | Automatically parse and format output |
| Plain Text | ✅ | UTF-8 text |
| PNG/JPEG/GIF | ✅ | Detected via magic bytes |
| ✅ | Detected via %PDF header | |
| Other Binary | ✅ | Display hexadecimal preview |
Common Scenarios
- Parse JWT Token: The payload of a JWT is Base64-encoded JSON
- View API Response: Some APIs return Base64-encoded data
- Handle Configuration Files: Kubernetes Secrets, etc. use Base64
- Image Data URI:
data:image/png;base64,...format - Debug Encrypted Data: View the original content before encryption