Base64 Encoder/Decoder
Encode text to Base64 or decode Base64 to text
Enter text above to encode or decode
Advanced Options
Input Validation
Enter some text to see validation results
Encoding History
No encoding history yet. Start encoding/decoding to build your history!
How to encode and decode Base64 online?
Encode and decode Base64 strings instantly with our secure, browser-based tool. Whether you're working with data transmission, file encoding, or API authentication, our Base64 encoder/decoder provides fast, reliable conversion with support for various input formats and real-time validation.
Features
- RFC 4648 standard Base64 (alphabet A-Z, a-z, 0-9, +, /) and URL-safe Base64 variant (- and _ replacing + and /) for use in URLs, JWT tokens, and filenames
- Optional padding stripping and MIME-style line wrapping at a configurable column (default 76 chars per RFC 2045)
- Full UTF-8 round-trip via encodeURIComponent before btoa, so emoji and non-ASCII characters survive encoding without mojibake
- Bonus encodings in the same UI: hexadecimal (lowercase, byte-padded), binary (8-bit groups, space-separated), ROT13, and Caesar cipher (shift 3)
- File mode: load any file up to 10 MB, auto-encode to Base64, and download the decoded binary back as a file (useful for data: URIs and email attachments)
- Live decode validation that flags wrong length (must be multiple of 4), invalid alphabet characters, and missing padding with specific error messages
- 'Convert to All Formats' batch action that runs the input through every encoder at once for quick comparison
- Local encoding history (last 50 operations, stored in localStorage) with input/output preview, format used, and timestamp
- Auto-process toggle so output updates as you type, with one-click swap between encode and decode modes
How to use
- Paste your text into the input box, or click 'Show File Upload' and select a file (up to 10 MB).
- Pick a format: Standard Base64 (RFC 4648), URL-Safe Base64, Hex, Binary, ROT13, or Caesar.
- Toggle Encode/Decode. With auto-process on, the result appears immediately as you type.
- Open Advanced Options to enable line wrapping (76 chars), strip padding =, or switch to URL-safe characters.
- Use 'Show Validation' when decoding to see exactly why an invalid Base64 string failed (length, alphabet, padding).
- Click Copy for the result, or Download Decoded File to save binary output back to disk.
Tips & Best Practices
- Always validate your data before processing to catch syntax errors early.
- Use the copy button to quickly transfer formatted output to your clipboard.
- For large files, consider breaking them into smaller chunks for better performance.
- Back up your original data before applying any transformations.
- Use keyboard shortcuts for faster workflow: Ctrl+A to select all, Ctrl+C to copy.
FAQ
Is Base64 encryption?
No. Base64 is a binary-to-text encoding defined in RFC 4648 that maps every 3 bytes to 4 ASCII characters using a fixed 64-character alphabet. Anyone can decode it instantly, including this tool. Use it for safely transporting binary data through text-only channels (JSON, XML, email MIME, data: URIs) but never as a security measure.
When should I use URL-safe Base64 instead of standard?
Standard Base64 uses + and /, which have special meaning in URLs (+ becomes a space in form encoding, / is a path separator), and = padding can also conflict with query strings. URL-safe Base64 (RFC 4648 §4) replaces + with - and / with _, and often drops = padding. JSON Web Tokens (JWT), OAuth state parameters, and webhook signatures all use the URL-safe variant; pick it whenever the output appears in a URL or filename.
Why is my decoded output garbled with non-English characters?
Raw atob() in browsers handles only Latin-1, so multibyte UTF-8 characters get corrupted. This tool wraps encoding in encodeURIComponent / unescape so a string like 'café 🚀' round-trips correctly. If you have a third-party Base64 string that decodes garbled here, the producer likely wasn't UTF-8 aware; ask them which charset they encoded from (Latin-1, Windows-1252, etc.).
How big a file can I encode in the browser?
The hard cap is 10 MB to keep memory usage reasonable, since Base64 inflates size by 33% (10 MB becomes ~13.3 MB of text plus DOM overhead) and atob/btoa are synchronous and not streamable. For larger files, encode server-side with Node's Buffer or use streaming Base64 libraries; do not paste megabytes of Base64 into web forms.
Why does my Base64 string fail to decode with 'invalid length'?
Standard Base64 output length must be a multiple of 4, padded with = if needed. Common causes of failure: padding was stripped (URL-safe variant) but you're decoding as standard, the string was line-wrapped and you copied only part of it, or whitespace and newlines mid-string. Toggle 'Show Validation' to see the exact problem; this tool also strips whitespace and newlines automatically before decoding.
Should I add line breaks to my Base64 output?
Add line breaks (76 chars per RFC 2045) when embedding Base64 in MIME email bodies, PEM-format certificates (64 chars), or anywhere a strict line-length limit applies. Skip line breaks for JSON values, URL parameters, JWTs, and database BLOB columns where embedded newlines cause parsing errors. The decoder here strips whitespace either way, so wrapping is cosmetic on the encode side.
Are ROT13 and Caesar real encryption?
No. ROT13 is a fixed 13-position letter substitution that has been broken since Roman times and is included only as a curiosity (it's symmetric: encoding twice returns the original). Caesar cipher with a configurable shift is similarly trivial to break by frequency analysis. Use them for spoiler tags or puzzles, never for actual confidentiality. For real encryption use AES-GCM or XChaCha20-Poly1305 in a dedicated library.
Does the tool send my data anywhere?
No. Encoding, decoding, validation, and file handling all run in your browser via standard atob/btoa and FileReader APIs. Your text and any uploaded file never reach a server, including for the history feature, which is stored only in localStorage on this device. You can confirm via the browser DevTools Network tab while using the tool.