API Reference
Technical reference for Base64 encoding and decoding operations.
Base64 Algorithm
Character Set
Base64 uses 64 characters to represent binary data:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
Encoding Process
- Input: Binary data or text
- Grouping: Group into 3-byte (24-bit) chunks
- Conversion: Convert each 24-bit group to 4 Base64 characters
- Padding: Add padding if needed
Decoding Process
- Input: Base64 encoded string
- Validation: Verify valid Base64 format
- Conversion: Convert 4-character groups to 3-byte chunks
- Output: Original binary data or text
Output Formats
Standard Base64
- Format: Traditional Base64 encoding
- Padding: Uses
=
for padding - Characters: A-Z, a-z, 0-9, +, /
- Use Case: General purpose encoding
Example:
Input: "Hello"
Output: "SGVsbG8="
URL-Safe Base64
- Format: Modified Base64 for URLs
- Padding: No padding characters
- Characters: A-Z, a-z, 0-9, -, _
- Use Case: URL parameters, filenames
Example:
Input: "Hello"
Output: "SGVsbG8"
Base64 Without Padding
- Format: Standard Base64 without padding
- Padding: No padding characters
- Characters: A-Z, a-z, 0-9, +, /
- Use Case: Specific applications
Example:
Input: "Hello"
Output: "SGVsbG8"
Character Encoding
UTF-8 (Recommended)
- Standard: Unicode Transformation Format
- Support: All Unicode characters
- Compatibility: Widely supported
- Use Case: International text
ASCII
- Range: 0-127 characters
- Support: Basic Latin characters
- Compatibility: Universal support
- Use Case: English text only
Latin-1 (ISO-8859-1)
- Range: 0-255 characters
- Support: Western European characters
- Compatibility: Good support
- Use Case: European languages
File Processing
Supported File Types
- Images: PNG, JPEG, GIF, WebP, SVG, BMP
- Documents: PDF, DOC, DOCX, TXT, RTF
- Archives: ZIP, RAR, 7Z, TAR, GZ
- Audio: MP3, WAV, OGG, FLAC
- Video: MP4, AVI, MOV, WMV
- Any Binary: All file types supported
File Size Limits
- Maximum Size: 10MB per file
- Memory Usage: Optimized for large files
- Processing: Chunked processing for efficiency
Error Handling
Common Errors
- Invalid Base64: Malformed Base64 string
- File Too Large: Exceeds size limits
- Unsupported Format: Invalid file type
- Encoding Error: Character encoding issues
Error Messages
- User-Friendly: Clear error descriptions
- Actionable: Suggests solutions
- Non-Technical: Easy to understand
- Helpful: Provides guidance
Performance Specifications
Processing Speed
- Text: Real-time processing
- Small Files: < 1 second
- Large Files: Depends on size and complexity
- Optimization: Efficient algorithms used
Memory Usage
- Minimal: Low memory footprint
- Efficient: Optimized for performance
- Cleanup: Automatic memory management
- Limits: Respects browser limitations
Browser Compatibility
Supported Browsers
- Chrome: Full support
- Firefox: Full support
- Safari: Full support
- Edge: Full support
- Mobile: iOS Safari, Chrome Mobile
Required Features
- File API: For file uploads
- Clipboard API: For copy functionality
- ES6+: Modern JavaScript features
- Web Workers: For large file processing
Integration Examples
JavaScript
// Encode
const encoded = btoa('Hello World');
console.log(encoded); // "SGVsbG8gV29ybGQ="
// Decode
const decoded = atob('SGVsbG8gV29ybGQ=');
console.log(decoded); // "Hello World"
Python
import base64
# Encode
encoded = base64.b64encode(b'Hello World').decode('utf-8')
print(encoded) # "SGVsbG8gV29ybGQ="
# Decode
decoded = base64.b64decode('SGVsbG8gV29ybGQ=').decode('utf-8')
print(decoded) # "Hello World"
PHP
// Encode
$encoded = base64_encode('Hello World');
echo $encoded; // "SGVsbG8gV29ybGQ="
// Decode
$decoded = base64_decode('SGVsbG8gV29ybGQ=');
echo $decoded; // "Hello World"
This API reference provides the technical foundation for understanding and implementing Base64 operations effectively.