Free Online Base64 Encoder & Decoder
Encode and decode Base64 strings and files instantly. Supports text encoding, URL-safe Base64, and file conversion, all running locally in your browser.
text_fields Input Text
code Base64 Output
text_fields Base64 Input
code Decoded Text
Key Features
Text Conversion
Easily encode text to Base64 and decode Base64 back to text with proper Unicode support.
File Support
Convert files to Base64 strings and decode Base64 back to downloadable files of any type.
Instant Processing
All operations run locally in your browser for instant results with no server latency.
Privacy Protected
Your data never leaves your browser. No server storage or tracking.
Frequently Asked Questions
Getting Started
What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format using 64 characters (A-Z, a-z, 0-9, +, /). It's commonly used for encoding images, files, and other binary data in text-based formats like JSON, XML, HTML, and URLs.
Why use Base64 encoding?
Base64 is used when you need to transmit binary data over channels that only support text (like email, JSON, or URLs). It's also used for embedding images directly in HTML/CSS, storing binary data in databases, and creating data URIs.
Is my data safe?
Yes. All encoding and decoding happens locally in your browser using JavaScript. Your files and data never leave your device or get sent to any server, ensuring complete privacy.
Using the Tool
How do I encode text to Base64?
Switch to the "Encode" tab, type or paste your text into the input box, and click "Encode to Base64". The encoded result will appear in the output box. You can then copy it to your clipboard.
Can I convert files to Base64?
Yes! Use the "File Support" tab to upload any file. The tool will convert it to a Base64 string. You can also convert Base64 back to a file and download it. All file types are supported.
Examples
Example: Encode simple text
Input:
Hello World
Base64 Output:
SGVsbG8gV29ybGQ=
Example: Encode JSON data
Input:
{"name":"John","age":30}Base64 Output:
eyJuYW1lIjoiSm9obiIsImFnZSI6MzB9
Technical Details
What is the '=' at the end?
The '=' characters are padding added to make the Base64 string length a multiple of 4. Padding may be 0, 1, or 2 '=' characters depending on the input length. Some variants like Base64URL omit padding.
Can I use this for passwords or secrets?
Base64 is NOT encryption — it's just encoding. Anyone can decode Base64, so never use it to secure sensitive information. For passwords and secrets, use proper encryption or hashing algorithms.
What is the difference between Base64 and Base64URL?
Base64URL is a URL-safe variant of Base64 that replaces "+" with "-" and "/" with "_", and removes padding "=" characters. This makes it suitable for use in URLs and filenames without requiring percent-encoding. For example:
Use Base64URL for JWT tokens, URL parameters, and filename-safe encoding. Use standard Base64 for data URIs, email attachments, and XML/JSON payloads.
Standard: aGVsbG8+/w==\nURL-Safe: aGVsbG8-_wUse Base64URL for JWT tokens, URL parameters, and filename-safe encoding. Use standard Base64 for data URIs, email attachments, and XML/JSON payloads.
Advanced Topics
Is Base64 encoding the same as encryption?
No, Base64 is encoding, not encryption. Encoding transforms data into a different representation using a reversible algorithm that requires no key to decode. Anyone who receives a Base64 string can decode it instantly without any secret. For sensitive data, use proper encryption algorithms like AES or ChaCha20 instead of Base64.
How does Base64 encoding affect file size?
Base64 encoding increases data size by approximately 33% because every 3 bytes of binary data are encoded as 4 ASCII characters. This overhead is why Base64 is typically used for small payloads like email attachments or embedded images via data URIs, not for large file transfers where bandwidth efficiency matters.
Does Base64 handle Unicode and UTF-8 characters correctly?
Yes, when properly implemented. The browser's btoa() function works with Latin-1 characters only, so for Unicode/UTF-8 text, the string must first be encoded as UTF-8 bytes before applying Base64. Our tool handles this automatically using the TextEncoder and TextDecoder Web APIs to ensure correct Unicode round-tripping.
How is Base64 used in data URIs for images?
Data URIs embed file data directly into HTML or CSS using the format "data:[mime];base64,[data]". For example, data:image/png;base64,iVBORw0... displays an image without a separate HTTP request. This is useful for small icons and sprites but inefficient for large images due to the 33% size overhead and lack of separate browser caching.
How is Base64 padding calculated and when can it be omitted?
Base64 padding uses '=' characters to make the output length a multiple of 4. For 1 byte of input, you get 2 padding characters (==). For 2 bytes, 1 padding character (=). For 3 bytes, no padding. Base64URL typically omits padding entirely since it is not needed for decoding — the decoder can infer padding from the string length modulo 4.
Last updated: July 14, 2026
Base64 is defined in RFC 4648 and documented on MDN Web Docs.