Base64 Encoder / Decoder
Encode and decode Base64 text and binary data with full UTF-8 Unicode and URL-safe support.
Base64 Encoder / Decoder
Convert text & UTF-8 unicode to Base64 and back. Supports URL-Safe mode.
What is the Base64 Encoder / Decoder?
The Base64 Encoder / Decoder is a fast, universal tool for converting plain text, binary byte arrays, and special characters into Base64 format and back. 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`, `+`, `/`).
Base64 is used everywhere in software development: embedding inline images in CSS/HTML data URLs, encoding HTTP Basic Auth headers (`Authorization: Basic ...`), transmitting binary file data over JSON APIs, and handling email attachments via MIME.
Full UTF-8 Unicode Support
Standard JavaScript `btoa()` and `atob()` functions crash when given Unicode characters (like emojis đĨ, accented characters, or non-Latin scripts) because they expect Latin1 characters. Our tool uses `TextEncoder` and `TextDecoder` byte stream APIs to ensure 100% accurate encoding and decoding for any character set or language.
Key Features
- Bidirectional Conversion: Seamlessly toggle between Encode and Decode modes with real-time output.
- URL-Safe Base64 Mode: Swap `+` and `/` for `-` and `_` and trim padding (`=`) for URL parameters.
- UTF-8 & Emoji Friendly: Encodes multi-byte UTF-8 symbols without throwing `InvalidCharacterError`.
- Character & Byte Counters: View input and output length, byte count, and expansion factor.
- File to Base64 Converter: Upload any image or file to generate a Data URL (`data:image/png;base64,...`).
How Does the Base64 Encoder / Decoder Work?
1. Select Mode: Choose Encode or Decode.
2. Enter or Paste Content: Type text or paste your Base64 string into the input field.
3. Toggle Options: Enable URL-safe mode if generating Base64 for query parameters or URLs.
4. Copy Output: Click Copy to Clipboard or download as text/binary file.
Formula & Calculation Method
Base64 Encoding Ratio:
For every 3 bytes (24 bits) of binary input, Base64 produces 4 ASCII characters (24 bits = 4 Ã 6-bit index).
Output Length â 4 Ã ceil(Input Bytes / 3)
Data Size Expansion â 33.3% increase in size.
Example Calculation
Input Text: "Hello, World! đ"
- UTF-8 Bytes: 19 bytes
- Encoded Base64: `SGVsbG8sIFdvcmxkISDwn5GJ`
- URL-Safe Base64: `SGVsbG8sIFdvcmxkISDwn5GJ`
- Size Expansion: 19 bytes â 24 characters (+26.3%)
Frequently Asked Questions
**Base64 Encoding Ratio:** For every 3 bytes (24 bits) of binary input, Base64 produces 4 ASCII characters (24 bits = 4 Ã 6-bit index). Output Length â 4 Ã ceil(Input Bytes / 3) Data Size Expansion â 33.3% increase in size.
Disclaimer: All developer utilities run 100% locally in your browser. None of your code, tokens, passwords, or input data are sent to or stored on remote servers.