Base64 Encode and Decode Online
Encode any text or file to Base64 for safe data transmission, or decode Base64 strings to retrieve the original content. This tool is essential for web development, email attachments, and data storage.
How the Base64 Encoder/Decoder Works
Select encode mode to convert text to Base64, or decode mode to convert Base64 back to text. Type or paste your content in the input field. The conversion happens automatically as you type.
Encoding transforms binary data into ASCII text using 64 characters: A-Z, a-z, 0-9, +, and /. The output is about 33% larger than the input. Padding with = signs ensures the length is a multiple of 4.
URL-safe mode replaces + with - and / with _, removing = padding. This makes Base64 strings safe for URLs and filenames without additional encoding. Toggle the checkbox to enable URL-safe output.
When You'd Actually Use This
Embedding images in HTML
Convert small images to Base64 data URIs. Embed directly in HTML without separate files. Useful for icons, logos, and single-file web pages.
Sending binary data in JSON
JSON doesn't handle binary data. Encode files, images, or encrypted data as Base64 strings. The API receives text that decodes back to binary.
Including credentials in HTTP headers
HTTP Basic Auth encodes "username:password" in Base64. The Authorization header carries "Basic dXNlcjpwYXNz". Never use without HTTPS.
Storing data in URLs
Pass data through URL parameters using URL-safe Base64. Query strings can't contain certain characters. URL-safe Base64 avoids encoding issues.
Decoding JWT tokens
JWT payloads are Base64URL encoded. Decode the middle section to see the token claims. Useful for debugging authentication issues.
Email attachments (MIME)
Email uses Base64 for attachments. Binary files become text that travels through email systems. Decode received attachments to restore original files.
What to Know Before Using
Base64 is encoding, not encryption.Anyone can decode Base64. It's for data representation, not security. Don't use to hide sensitive information.
Output is larger than input.Base64 adds about 33% overhead. Four output characters represent three input bytes. Consider compression for large data.
Padding may be optional.Standard Base64 uses = for padding. Some implementations omit it. This tool handles both padded and unpadded input.
URL-safe Base64 differs slightly.Standard uses + and /. URL-safe uses - and _. URL-safe omits padding. Both decode to the same data.
Pro tip: For JWT tokens, always use URL-safe Base64. Standard Base64 characters break URLs. JWT libraries handle this automatically, but manual decoding requires URL-safe mode.
Common Questions
Why is Base64 used?
Base64 converts binary to text. Text travels safely through systems designed for text (email, JSON, URLs). Binary data might get corrupted in text-only channels.
Can I encode files?
Yes, use the upload button for text files. For binary files, you'd need a file-to-Base64 converter. This tool handles text input primarily.
What does the padding mean?
Padding (=) makes the output length a multiple of 4. One = means 2 bytes in the last group. Two = means 1 byte. No = means 3 bytes.
Is Base64 reversible?
Yes, perfectly. Decoding Base64 always returns the exact original data. No information is lost. It's a lossless encoding scheme.
What characters are in Base64?
A-Z (26), a-z (26), 0-9 (10), plus +, and slash /. That's 64 characters. URL-safe replaces + with - and / with _.
Can Base64 contain spaces?
Standard Base64 doesn't include spaces. Some implementations add line breaks every 76 characters (MIME format). This tool produces continuous output.
Why is my decoded text garbled?
The Base64 might encode binary data, not text. Or the wrong character encoding was used. Try different encodings (UTF-8, Latin-1) if text looks wrong.
Other Free Tools
UTF-8 Encoder/Decoder
UTF-8 Encoder and Decoder
Binary Encoder/Decoder
Binary Encoder and Decoder
Hex Encoder/Decoder
Hexadecimal Encoder and Decoder
ASCII Code Converter
ASCII Code Converter and Table
ASCII to Hex Converter
ASCII to Hex Converter: Text to Hexadecimal Translator
Barcode Generator
Free Barcode Generator
Binary to Text Converter
Binary to Text Converter
Free Printable Calendar Maker
Create & Print Your Custom Calendar
Pie Chart Maker
Free Pie Chart Maker Online