What is Base64?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It's commonly used to encode data when there's a need to store or transfer data over media designed for textual data.
📧 Email Attachments
Base64 encodes binary attachments so they can be transmitted in email messages (MIME).
🌐 Data URLs
Embed images directly in HTML/CSS using data:image/png;base64,...
🔑 API Authentication
Many APIs use Base64 for Basic Auth headers and JWT tokens.
💾 Data Storage
Store binary data in JSON, XML, or databases that only support text.
Frequently Asked Questions
What is Base64 encoding?
Base64 is an encoding scheme that converts binary data into a text format using 64 printable ASCII characters (A-Z, a-z, 0-9, +, and /).
The name "Base64" comes from using 64 different characters. Each Base64 digit represents exactly 6 bits of data, so 4 Base64 characters represent 3 bytes (24 bits) of data.
How does Base64 encoding work?
Base64 encoding works by:
- Taking the input data as a sequence of bytes
- Grouping the bytes into chunks of 3 (24 bits)
- Splitting each 24-bit chunk into 4 groups of 6 bits
- Converting each 6-bit value to one of 64 characters
- Adding padding (=) if the input length isn't divisible by 3
Example: "Hi" → Binary → Base64 → "SGk="
Is Base64 encoding secure? Is it encryption?
No, Base64 is NOT encryption. It provides zero security.
Base64 is an encoding scheme, not an encryption algorithm. Anyone can decode Base64 data without any key or password. It's designed for data transport, not security.
Use Base64 for:
- ✅ Transmitting binary data over text-only channels
- ✅ Embedding images in HTML/CSS
- ✅ Encoding data for APIs
Don't use Base64 for:
- ❌ Hiding sensitive information
- ❌ Password protection
- ❌ Any form of security
Does Base64 encoding increase file size?
Yes, Base64 increases size by approximately 33%.
Since Base64 uses 4 characters to represent 3 bytes of data, the encoded output is always 4/3 (≈1.33x) the size of the original data, plus padding.
Example: A 1 MB file becomes approximately 1.33 MB when Base64 encoded.
What is URL-safe Base64?
Standard Base64 uses + and / characters which have special meaning in URLs. URL-safe Base64 replaces:
+→-(hyphen)/→_(underscore)
This allows Base64 data to be safely included in URLs without encoding issues.
How to decode Base64 in terminal/command line?
Linux/Mac:
echo "SGVsbG8gV29ybGQ=" | base64 -d
Windows PowerShell:
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("SGVsbG8gV29ybGQ="))
Python:
import base64
base64.b64decode("SGVsbG8gV29ybGQ=").decode()
How to encode a file to Base64?
Linux/Mac:
base64 filename.txt > encoded.txt
Or use this tool: Click "Upload" to select a file, then encode it directly in your browser.
Can I decode Base64 images?
Yes! If you have a Base64-encoded image (often starting with data:image/png;base64, or similar), you can:
- Paste the Base64 string into this tool
- Select "Decode" mode
- The tool will detect it's binary data
- Download the decoded file
The tool supports images, PDFs, and any other file type.
Is this Base64 tool safe to use?
Yes, 100% safe!
- ✅ All processing happens in your browser (client-side JavaScript)
- ✅ No data is sent to any server
- ✅ Works completely offline once loaded
- ✅ Open source and transparent
Your data never leaves your device.
What characters are used in Base64?
Standard Base64 uses 64 characters:
- A-Z (26 characters)
- a-z (26 characters)
- 0-9 (10 characters)
- + and / (2 characters)
- = (padding character)
URL-safe Base64 replaces + with - and / with _