🔐 Base64 Encoder / Decoder
Encode text, images, and files to Base64 format. Decode Base64 back to original text, view images in real-time, and download decoded files. Perfect for developers, data transmission, and embedding resources in HTML/CSS/JavaScript.
Encode to Base64
Decode from Base64
Image to Base64 Converter
Drag & drop an image here or click to select
Supports: JPG, PNG, GIF, SVG, WebP (Max 5MB)
Base64 to Image Converter
Paste a complete data URI like: data:image/png;base64,iVBORw0KGgo...
File to Base64 Converter
Drag & drop any file or click to select
Supports: Any file type (Max 10MB)
Base64 to File Converter
For large files, Base64 strings can be very long. Preview only shows first 200 characters.
HTML Image Embedding
Use Base64 to embed images directly in HTML (reduces HTTP requests):
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..." alt="Embedded Image">
CSS Background Image
Use Base64 in CSS for background images (no separate file needed):
.element {
background-image: url('data:image/png;base64,iVBORw0...');
background-size: cover;
}
JavaScript Data URI
Store binary data in JavaScript variables:
const imageData = "data:image/png;base64,iVBORw0...";
const img = new Image();
img.src = imageData;
Email Attachments (MIME)
Base64 is used in email for attachments (MIME encoding):
Content-Type: image/png
Content-Transfer-Encoding: base64
iVBORw0KGgoAAAANSUhEUgAA...
Frequently Asked Questions About Base64
What is Base64 encoding and why is it used?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It's commonly used for:
- Embedding images in HTML/CSS (data URIs)
- Email attachments (MIME encoding)
- Storing binary data in JSON/XML
- Transmitting data through text-based protocols
- Encoding credentials for HTTP Basic Authentication
Base64 ensures data integrity when moving between systems that handle text differently.
Is Base64 encryption? Can it be decoded easily?
No, Base64 is encoding, not encryption! It doesn't provide any security - anyone can decode it easily using tools like this one. Base64 is simply a way to represent binary data as text. For actual security, use proper encryption algorithms like AES, RSA, etc. Base64 is often combined with encryption to make encrypted binary data text-safe for transmission.
Why is Base64 larger than the original file?
Base64 uses 4 characters to represent every 3 bytes of original data. This results in approximately 33% size increase. For example:
- 3 bytes (24 bits) → 4 Base64 characters (24 bits + padding)
- Padding '=' characters are added to make length multiple of 4
- 100 KB file → ~133 KB Base64 string
This overhead is the trade-off for being able to transmit binary data through text-only systems.
When should I use Base64 for images vs regular image files?
✅ Use Base64 for:
- Small images (icons, logos under 10KB)
- Reducing HTTP requests (fewer files to load)
- Single-file HTML/CSS documents
- Dynamic image generation in JavaScript
- Email signatures and attachments
❌ Avoid Base64 for:
- Large images (photos, high-res graphics)
- Images used multiple times (can't cache separately)
- When file size is critical (33% overhead)
- CDN-hosted images (better caching with separate files)
What are data URIs and how do I use them?
Data URIs (Uniform Resource Identifiers) allow embedding files directly in web pages using the format:
data:[<mediatype>][;base64],<data>
Examples:
data:image/png;base64,iVBORw0...- PNG imagedata:text/plain;base64,SGVsbG8=- Text filedata:application/pdf;base64,JVBERi0...- PDF file
Our tool automatically generates proper data URIs with correct MIME types.
Base64 Technical Details
Base64 Character Set
65 characters: A-Z, a-z, 0-9, +, /, = (padding)
Common MIME Types
image/png- PNG imagesimage/jpeg- JPEG imagesimage/gif- GIF imagesimage/svg+xml- SVG imagestext/plain- Text filestext/html- HTML filesapplication/pdf- PDF filesapplication/json- JSON data
Quick Facts
- • 3 bytes → 4 Base64 chars
- • 33% size increase
- • Padding '=' for alignment
- • Safe for text protocols
- • Not encrypted