Base64 encode & decode
Encode text, JSON, tokens, and files to Base64 or decode Base64 back to plain text and binary files entirely in your browser. Features complete UTF-8 Unicode support for international characters and emojis (avoiding browser btoa Latin-1 crashes), RFC 4648 §5 URL-safe alphabet conversion (- and _ instead of + and /), customizable line wrapping (64 chars for PEM certificates, 76 chars for MIME email), and client-side file encoding to Data URLs and HTML snippets. Nothing leaves your browser.
Example
Encoding UTF-8 payload with emoji and URL-safe characters
Text 'Hello, 世界! 🌍' encodes cleanly via UTF-8 bytes to 'SGVsbG8sIOS4lueVjCEg8J+Mjg==', with instant one-click toggle to URL-safe format and copy.
Related: JWT decoder, Text diff checker, Hash generator, Password generator, UUID generator
FAQ
- Does this Base64 tool send my data or files to any server?
- No. All encoding and decoding happen directly inside your browser tab using JavaScript TextEncoder, TextDecoder, and FileReader APIs. Your strings and files never leave your computer.
- Why do some online Base64 encoders fail on emojis and foreign languages?
- The standard JavaScript btoa() function only supports ASCII / Latin-1 characters (character codes 0-255) and throws an InvalidCharacterError when encountering Unicode characters. Plaintools encodes text into UTF-8 bytes first using TextEncoder, ensuring all international alphabets and emojis encode and decode flawlessly.
- What is URL-safe Base64 (RFC 4648 §5)?
- Standard Base64 uses the plus sign (+) and slash (/), which have special meaning in URL query strings and path segments. URL-safe Base64 replaces '+' with '-' and '/' with '_', and often omits trailing padding '=' characters so the string can be safely placed in URLs and JSON Web Tokens (JWTs).
- Can I convert local files and images to Base64 data URLs?
- Yes. In the 'File to Base64' tab, you can drag and drop any image, document, audio, or binary file. The tool generates raw Base64, complete data URIs (data:image/png;base64,...), and ready-to-paste HTML img or CSS background-image snippets.
- Can I decode Base64 back into a downloadable file?
- Yes. When converting in file mode or decoding a file data URL, you can download the reconstructed binary data directly to your computer as a local file.
- How do I encode Base64 in JavaScript without btoa Latin-1 errors?
- Use TextEncoder and TextDecoder: const bytes = new TextEncoder().encode(str); const b64 = btoa(String.fromCharCode(...bytes)); To decode: const bytes = Uint8Array.from(atob(b64), c => c.charCodeAt(0)); const str = new TextDecoder().decode(bytes).
- Is Base64 a form of encryption?
- No. Base64 is a binary-to-text encoding format designed to transmit binary data over text-based protocols (like HTTP and email). Anyone can decode Base64 instantly without a key. Do not use Base64 to secure sensitive passwords or credentials.