What is Base64 Encoding/Decoding?
Base64 is an encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /) plus a padding character (=). Standardized in the MIME specification (RFC 2045) in 1992, it remains essential for email attachments, Data URI embedding in web pages, HTTP Basic authentication, JWT tokens, OAuth parameters, and any scenario where binary data must be transmitted as text. Base64 is encoding, not encryption. Anyone can decode it back to the original data, so it should never be used for security purposes. It's purely a conversion scheme for safely transporting binary data as text. This tool performs real-time conversion entirely in your browser — your data is never sent to any server.
How to Use This Base64 Tool
Enter text in the "Text" panel on the left, and the Base64-encoded result appears in the "Base64" panel on the right in real-time. Conversely, paste Base64 into the right panel to see the decoded text on the left. Both directions work simultaneously — a true bidirectional interface. Enable the "URL-safe" toggle when you need URL-safe Base64. Standard Base64 characters (+, /, =) cause problems in URLs and JWT tokens, so URL-safe encoding is required in those contexts. If decoded text appears garbled (mojibake), switch the character encoding selector to Shift-JIS or EUC-JP. Legacy Japanese systems and emails often contain Base64-encoded data in Shift-JIS. Use the copy button to grab the result.
How Base64 Works
Base64 splits input data into 6-bit chunks and maps each chunk to one of 64 characters. Since normal characters use 8 bits (1 byte) but Base64 uses 6 bits per character, every 3 bytes of input (24 bits) becomes 4 Base64 characters (4 × 6 = 24 bits). This conversion increases data size by approximately 33% (4/3 ratio). For example, 3 bytes of image data become 4 characters of Base64 text. With MIME encoding, line breaks are inserted every 76 characters, bringing the actual increase to about 37%. This tool displays input bytes, output bytes, and the size ratio in real-time, so you can see exactly how much your data grows during encoding.
URL-safe Base64 (Base64URL)
Standard Base64 uses three characters — '+', '/', and '=' — that have special meanings in URLs and filenames. URL-safe Base64 (RFC 4648 §5, also called Base64URL) solves this by replacing '+' with '-', '/' with '_', and removing the padding '='. JWT tokens (JSON Web Tokens), OAuth 2.0 authentication parameters, and Google API request parameters all use URL-safe Base64 as their standard encoding. Simply enable the "URL-safe" toggle in this tool to switch between standard and URL-safe Base64.
Frequently Asked Questions
- What is Base64?
- Base64 is an encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It's commonly used for email attachments (MIME), Data URIs, HTTP Basic authentication, and JWT tokens — anywhere binary data needs to be transmitted as text.
- Is Base64 encryption?
- No. Base64 is an encoding, not encryption. Anyone can decode Base64 back to the original data. It should never be used to protect passwords or sensitive information. Use proper encryption (e.g., AES) for security purposes.
- How does Base64 affect data size?
- Base64 encoding increases data size by approximately 33% (4/3 ratio). This is because every 3 bytes of input are converted to 4 Base64 characters. This tool displays the size ratio in real-time as you encode.
- What is Base64 used for?
- Common uses include MIME encoding for email attachments, Data URI image embedding in HTML/CSS, HTTP Basic authentication headers, JWT token construction (each part — header, payload, signature — is Base64URL-encoded), and any scenario where binary data needs to be represented in text formats like JSON or XML.
- What are the benefits of Base64-encoding images?
- Converting images to Base64 Data URIs and embedding them in HTML/CSS reduces HTTP requests. This is effective for small icons and logos (a few KB or less). However, since Base64 increases size by ~33%, it's counterproductive for large images. This tool shows a preview when Base64 data contains an image — try pasting a data:image URI to see it in action.