Base64 Encoder / Decoder
Encode text or files to Base64 string, or decode Base64 back to original text or file.
What is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that converts binary data into a sequence of printable ASCII characters. It uses a set of 64 characters — uppercase and lowercase letters, digits, +, and / — to represent arbitrary binary data. Base64-encoded data is approximately 33% larger than the original but can be safely transmitted over text-based protocols like HTTP, email (SMTP), and JSON.
Base64 is widely used in web development for embedding images in CSS or HTML via data URIs, encoding binary attachments in email, storing cryptographic keys, and transmitting binary payloads in APIs. The URL-safe variant replaces + with - and / with _ to avoid conflicts with URL-reserved characters.
How to Use This Tool
To encode: Select "Encode" mode, then either type or paste text into the text field, or switch to the File tab to upload any file. Optionally enable URL-safe mode or MIME line breaks, then click Encode. The Base64 output appears below with character count and size statistics.
To decode: Select "Decode" mode, paste your Base64 string into the input area, and click Decode. The tool validates the Base64 format in real time, then decodes it to text or a downloadable file. Image files are previewed directly in the browser. If your input uses URL-safe characters, enable the corresponding option before decoding.
Common Use Cases
Base64 encoding is used in countless scenarios: embedding images inline in HTML emails or CSS stylesheets, encoding JWT (JSON Web Token) payloads, transmitting binary data in JSON REST APIs, storing binary certificates in PEM format, generating data URIs for fonts or icons, and encoding credentials in HTTP Basic Authentication headers. Developers also use it when debug-logging binary buffers to prevent terminal corruption.
Frequently Asked Questions
Is Base64 a form of encryption?
No. Base64 is an encoding scheme, not encryption. It makes data unreadable at a glance but provides zero security — anyone can decode it instantly. Never use Base64 to protect sensitive data. Use proper encryption (AES, RSA, etc.) if security is required.
Why does Base64 output end with "=" or "=="?
Base64 encodes data in groups of 3 bytes into 4 characters. If the input length is not a multiple of 3, padding characters (=) are appended to make the output length a multiple of 4. URL-safe mode often omits padding since the recipient knows to add it back.
What is URL-safe Base64?
Standard Base64 uses + and /, which have special meaning in URLs. URL-safe Base64 replaces them with - and _ respectively, making the encoded string safe to include in URLs and filenames without percent-encoding. It is commonly used in JWTs and OAuth tokens.
How much larger is Base64 output compared to the original?
Base64 encoding increases the data size by approximately 33–36%. Every 3 bytes of input become 4 ASCII characters of output. If MIME line breaks are added (a newline every 76 characters), the overhead is slightly higher.
Can I encode binary files (images, PDFs) with this tool?
Yes. Switch to the "File Input" tab in Encode mode and upload any file. The tool reads it as binary data and encodes it to Base64. For images, the output can be used directly as a data: URI. The decoded binary can also be downloaded as a file.
Does this tool send my data to a server?
No. All encoding and decoding happens entirely in your browser using JavaScript. Your text or files never leave your device, making this tool safe for sensitive or private data.
