Base64 Encoder/ Decoder
Encode text to Base64 or decode Base64 back to text.
How to Use This Tool
- Paste the source string or data into the Base64 Encoder input box above.
- The Base64 Encoder processes the input instantly and shows the result in the output box below.
- Copy the encoded or decoded result with one click, or switch direction to reverse the operation.
Common Use Cases
- Email attachments: MIME-encoded email bodies use Base64 to safely transmit binary attachments through 7-bit SMTP infrastructure.
- Data URIs: Embed small images directly in CSS or HTML using data:image/png;base64,... to reduce HTTP requests on landing pages.
- API authentication: Encode "username:password" for HTTP Basic Auth headers, or pass binary payloads through JSON-only APIs.
Frequently Asked Questions
Why does Base64 output use roughly 33% more characters than input?
Base64 encodes every 3 bytes of binary data into 4 ASCII characters (6 bits each), so output size is ceil(n/3) * 4. A 300 KB image becomes a 400 KB Base64 string. Add gzip on top for transport to recover most of the overhead.
What's the difference between standard and URL-safe Base64?
Standard Base64 (RFC 4648 section 4) uses + and / which are reserved in URLs. URL-safe Base64 (section 5) substitutes - and _ and drops the = padding. JWTs use URL-safe Base64; choose the variant matching your downstream consumer.
Can I Base64-decode any string?
Only strings whose length is a multiple of 4 (or with proper = padding) and that contain only valid Base64 characters. Invalid input throws an error. Whitespace and line breaks are stripped before decoding, so wrapped Base64 from email headers works fine.