Base64 Encoder & Decoder
Base64 is a binary-to-text encoding scheme that converts binary data into ASCII characters. This tool lets you encode plain text to Base64 or decode Base64 strings back to readable text, with full support for UTF-8 characters.
Tip: Base64 encoding is commonly used to encode binary data for transmission over text-based protocols. It's not encryption and should not be used for security purposes.
How to Use Base64 Encoder/Decoder
- 1
Select Mode
Choose "Encode" to convert text to Base64, or "Decode" to convert Base64 back to text.
- 2
Enter Your Input
Paste your plain text (for encoding) or Base64 string (for decoding) into the input field.
- 3
Get Your Result
Click the action button and copy your encoded/decoded result from the output field.
Frequently Asked Questions
What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It's commonly used to encode binary data like images or files for transmission over text-based protocols like email or HTTP.
Is Base64 encryption?
No, Base64 is not encryption. It's an encoding scheme that makes binary data readable as text. Anyone can decode Base64 data without a key. Never use Base64 for securing sensitive information.
Why does Base64 make data larger?
Base64 encoding increases data size by approximately 33%. This is because it uses 4 ASCII characters to represent every 3 bytes of input data. The trade-off is compatibility with text-based systems.
What are common uses for Base64?
Base64 is commonly used for embedding images in HTML/CSS, encoding email attachments, storing binary data in JSON, transmitting data in URLs, and basic data obfuscation (not security).
Common Use Cases
Data URIs: Embed small images or fonts directly in HTML/CSS using data:image/png;base64,.... Encode the binary file and paste into the data URL.
Email attachments: MIME uses Base64 to encode binary attachments. Understanding the format helps debug malformed or oversized messages.
JSON payloads: APIs sometimes Base64-encode binary data inside JSON. Decode to inspect or verify the content.
Basic Auth headers: HTTP Basic auth encodes username:password as Base64. Decode to verify credentials during debugging (never log in production).
CLI Commands
$ base64 input.txt
$ base64 -d encoded.txt
Buffer.from(str, 'base64').toString('utf8')
Python: base64.b64encode() and base64.b64decode() from the standard library.
Edge Cases
- Padding: Base64 output is padded with
=so length is a multiple of 4. Missing or extra padding causes decode errors. - URL-safe Base64: Standard Base64 uses
+and/, which are unsafe in URLs. URL-safe variants use-and_. - UTF-8: Encoding multi-byte Unicode correctly requires UTF-8 handling. Our tool supports full UTF-8 input and output.
- Invalid input: Non-Base64 characters (e.g. spaces, line breaks) in decode input will fail. Strip whitespace first if needed.
Security Notes
Base64 is not encryption. It is trivially reversible. Never use it to protect passwords, tokens, or secrets. For credentials, use proper authentication flows. For integrity, use hashes (see our Hash Generator). Base64-encoded data in URLs or HTML can expose content; avoid encoding sensitive data in client-visible strings.