What is Base64 Encode / Decode?
The Base64 Encoder / Decoder converts text to and from Base64, including the URL-safe variant. Base64, defined in RFC 4648, represents binary data using 64 printable ASCII characters so it can travel safely through channels that expect text, such as email, JSON, and data URIs.
The tool is UTF-8 aware: it encodes text to bytes with the standard TextEncoder before Base64-encoding, so accented letters, emoji, and other multi-byte characters round-trip correctly. Standard Base64 uses + and / with = padding; the URL-safe option uses - and _ and drops padding.
Base64 is an encoding, not encryption. It provides no confidentiality — anyone can decode it. It runs entirely in your browser.
Why Use This Tool?
Many transports and formats only accept text. Base64 lets you embed binary or non-ASCII content — images in data URIs, tokens, small file blobs — inside text-only fields without corruption.
- Embed binary safely in JSON, HTML, or URLs.
- Handle UTF-8 text without mojibake.
- Switch between standard and URL-safe alphabets.
- Decode values you receive from APIs or tokens.
How Does This Tool Work?
To encode, the tool converts your text to UTF-8 bytes, then maps each group of three bytes to four Base64 characters using btoa on the binary string. For URL-safe output it replaces + with - and / with _ and strips trailing = padding.
To decode, it reverses URL-safe substitutions, restores padding to a multiple of four, decodes with atob, and interprets the resulting bytes as UTF-8. Invalid Base64 input produces a decode error.
Understanding Your Results
Encoded output is about one third larger than the input because every three bytes become four characters. Standard output may end with one or two = characters as padding; URL-safe output omits them.
If decoding fails, the input is not valid Base64 for the selected mode. A common mistake is decoding a URL-safe string in standard mode (or vice versa) — enable the matching option.
Why Tracking This Matters
Base64 is everywhere: JWT segments, data URIs, Basic auth headers, and binary fields in JSON. Understanding that it is reversible and offers no security prevents the common mistake of treating Base64 as if it hides sensitive data.
Benefits of Using Base64 Encode / Decode
- Standard and URL-safe alphabets
- Correct UTF-8 handling
- Encode and decode in one place
- Automatic padding restoration on decode
- Clear encoding-not-encryption guidance
- Fully in-browser processing
How Is the Result Calculated?
Base64 packs 3 input bytes (24 bits) into 4 output characters of 6 bits each. When the input length is not a multiple of three, padding = characters fill the final group. Encoded length is therefore approximately ceil(n / 3) × 4 characters for n input bytes.
encoded length ≈ ceil(bytes / 3) × 4
Tips for Better Results
- Use URL-safe mode for values placed in query strings or paths.
- Match the decode mode to how the string was encoded.
- Do not rely on Base64 to hide secrets — it is trivially reversible.
- Expect roughly 33% size growth when encoding.
- Strip surrounding whitespace or line breaks before decoding.
Standards and References
Conclusion
The Base64 tool encodes and decodes both standard and URL-safe Base64 with proper UTF-8 handling, exactly per RFC 4648.
Remember it is an encoding for transport, not a security mechanism — use it to move data safely through text channels, not to protect secrets.