Convert between plain text and Base64 encoding instantly.
Base64 encoding converts binary data into ASCII text. Common uses: encoding credentials for HTTP Basic Auth, embedding images in CSS/HTML, or safely transmitting data in URLs and JSON.
Base64 is an encoding scheme that converts binary data into ASCII text format using 64 printable characters (A-Z, a-z, 0-9, +, /). It's NOT encryption or compression—it's purely encoding for safe data transmission.
Base64 encoding can be easily reversed (decoded). Do NOT use it to hide sensitive information like passwords. Use proper encryption (AES, RSA) for security. Base64 is for encoding, not encrypting.
data:image/png;base64,...)Input: Hello World!
Output: SGVsbG8gV29ybGQh
// Decoding reverses it perfectly:
Input: SGVsbG8gV29ybGQh
Output: Hello World!
// Credentials
Username: admin
Password: secret123
// Combine with colon
Text: admin:secret123
// Encode
Base64: YWRtaW46c2VjcmV0MTIz
// Use in header
Authorization: Basic YWRtaW46c2VjcmV0MTIz
// Small icon as data URL
<img src="data:image/png;base64,iVBORw0KGg..." />
// No HTTP request needed - image is embedded in HTML
NO! Base64 is easily reversible. Anyone can decode it. Use proper password hashing (bcrypt, Argon2) or encryption (AES-256) for sensitive data. Base64 is for encoding, not security.
Base64 increases size by ~33%. This is because it converts 3 bytes (24 bits) into 4 Base64 characters. Example: 100 bytes becomes ~133 bytes. This trade-off allows binary data to be safely transmitted as text.
The = character pads the output to a multiple of 4 characters.
Example: SGVsbG8= has one padding, SGk= has one.
It ensures proper decoding by indicating how many bytes the original data had.
Yes! Images, PDFs, and any binary file can be Base64-encoded. However, large files create very long strings. Base64 is best for small files (icons, small images) or when you need to embed data in text formats (JSON, XML, HTML).
// Encode
const encoded = btoa('Hello World');
console.log(encoded); // SGVsbG8gV29ybGQ=
// Decode
const decoded = atob('SGVsbG8gV29ybGQ=');
console.log(decoded); // Hello World
import base64
# Encode
encoded = base64.b64encode(b'Hello World')
print(encoded) # b'SGVsbG8gV29ybGQ='
# Decode
decoded = base64.b64decode(encoded)
print(decoded) # b'Hello World'