Base64 Encode/Decode
Encode UTF-8 text to Base64 or decode Base64 strings back to text instantly.
Encode UTF-8 text to Base64 or decode Base64 back to text, with standard and URL-safe alphabets plus optional padding control.
Use Base64 Encode/Decode
Plain text to encode
Base64 result
Built for the task, not the page view
- Full Unicode and UTF-8 multi-byte character support
- Standard and URL-safe Base64 alphabets
- Optional Base64 padding control
- Encode/decode mode switching with inline validation
- Copy and text download for generated output
UTF-8 TextBase64 StringBase64UTF-8 TextUse it correctly
Base64 is encoding, not encryption
Base64 is an open representation format designed to transport binary data over text-only channels. It provides zero confidentiality, privacy, or security. Anyone with access to a Base64 string can decode it instantly without a key or password. Never use Base64 alone to protect passwords, personal data, or private credentials.
Unicode and UTF-8 multi-byte characters
Legacy JavaScript window.btoa() fails on characters outside Latin1 (code point > 255), throwing exceptions on emojis and international alphabets. This engine uses native TextEncoder and TextDecoder to serialize arbitrary Unicode characters into valid UTF-8 byte streams before Base64 transformation, preserving all symbols accurately.
Why Base64 increases size by ~33%
Base64 encodes every 3 bytes (24 bits) of raw data into 4 printable ASCII characters (each carrying 6 bits). This produces a 4:3 expansion ratio, increasing overall payload size by approximately 33.3% (plus any trailing padding characters). Consider this overhead when embedding large media or documents into JSON, HTML, or CSS.
Padding (=) and URL-safe variants (RFC 4648)
Standard Base64 (RFC 4648 §4) uses + and / with = padding characters to complete 4-character blocks. URL-safe Base64 (RFC 4648 §5) substitutes - for + and _ for /, making strings safe for URL paths, query parameters, and JWT tokens without percent-encoding, and frequently omits trailing = padding.
Local browser processing
All encoding and decoding operations execute locally in your browser tab using Web APIs and typed arrays. Your content is processed entirely in local memory and is never transmitted to an EveryTools transformation API or logged to external servers.
Standard vs. URL-Safe Base64 (RFC 4648)
Base64 maps binary octets to human-readable ASCII characters. While standard Base64 works well for MIME emails and HTTP headers, URL-safe Base64 prevents collisions with reserved URL and filesystem delimiters.
| Specification | Index 62 | Index 63 | Padding (=) | Safe in URLs? | Primary Use Cases |
|---|---|---|---|---|---|
| RFC 4648 §4 (Standard) | + | / | Required / Standard | No (needs %2B, %2F escaping) | MIME emails, HTTP Basic Auth, Data URIs |
| RFC 4648 §5 (URL-Safe) | - | _ | Optional / Usually omitted | Yes (no percent-encoding needed) | JSON Web Tokens (JWT), OAuth 2.0 PKCE, URL query strings |
Understanding 24-bit bit packing and padding
Base64 groups 3 input bytes (24 bits) into 4 six-bit chunks (sextets). When the input length is not a multiple of 3, padding characters (=) are appended to complete the final 4-character output block:
| Input Remainder | Remaining Bits | Base64 Output Format | Trailing Padding | Example |
|---|---|---|---|---|
| 0 bytes (length % 3 == 0) | 0 bits | 4 full sextet characters | None | Man → TWFu |
| 2 bytes (length % 3 == 2) | 16 bits | 3 sextet characters + 1 pad | = | Ma → TWE= |
| 1 byte (length % 3 == 1) | 8 bits | 2 sextet characters + 2 pads | == | M → TQ== |
Common decoding errors and troubleshooting
| Diagnostic | Example Cause | Resolution |
|---|---|---|
Invalid Base64 character | String contains illegal characters such as @, $, or unescaped symbols | Check that the input was not truncated or mixed with surrounding text or quotation marks. |
Unexpected character following padding "=" | Padding character = appears in the middle of the string | Ensure two concatenated Base64 strings were not accidentally joined together. |
Invalid Base64 length: trailing standalone character | String length mod 4 equals 1 (an impossible single-character 6-bit remainder) | Verify the entire string was copied; Base64 blocks require at least 2 characters for 8 bits. |
Decoded data is not valid UTF-8 text | Payload represents raw binary (PNG, PDF, ZIP) rather than UTF-8 encoded text | Use a specialized binary or image decoder; raw byte streams cannot be decoded into valid UTF-8 text. |