Base64 Encoder & Decoder — Unicode-Safe, Runs in Your Browser
Base64 encodes binary data as ASCII text using 64 characters; output is about 33% larger than input. This tool handles full Unicode including emoji and offers URL-safe mode for tokens and query strings. Paste text below to encode or decode — nothing leaves your browser.
What is Base64?
Base64 is a binary-to-text encoding that represents binary data using 64 ASCII characters (A–Z, a–z, 0–9, +, /). It packs 3 input bytes into 4 output characters, making encoded data safe for text-based protocols like email and JSON. See: RFC 4648.
Why Use This Tool
- Data URIs — Embed images or fonts directly in HTML/CSS without external files. Convert images →
- Email attachments (MIME) — Encode binary files for text-based email transport.
- JSON APIs — Send binary data safely in JSON payloads. Format JSON →
- HTTP Basic Auth — Encode username:password for Authorization headers.
- JWT tokens — Header and payload are Base64url-encoded (URL-safe variant). Decode JWTs →
- URL parameters — Encode binary data for query strings using URL-safe mode. URL encode →
Tips
- Base64 is encoding, not encryption — anyone can decode it.
- Use URL-safe mode for tokens, query params, or file names.
- Encoded output is always ~33% larger than the input.
- This tool supports full Unicode (emoji, CJK, accents).
- No data is sent to any server — conversion is 100% local.
How to Use the Base64 Encoder / Decoder
Paste your text
Type or paste any text into the input panel. Unicode, emoji, and multi-line text are all supported.
Choose Encode or Decode
Select Encode to convert plain text to Base64, or Decode to convert Base64 back to plain text.
Toggle URL-safe mode (optional)
Enable URL-safe mode if your output will be used in a URL, filename, or JWT token. It replaces +/with -_.
Copy the result
Click Copy to copy the encoded or decoded string to your clipboard.
Worked Examples
Encode plain text
hello
aGVsbG8=
Decode Base64
SGVsbG8gV29ybGQh
Hello World!
Unicode text
नमस्ते
4KSo4KSu4KS44KWN4KSk4KWH
Text is UTF-8 encoded before Base64 conversion.
Emoji support
👋🌍
8J+Ri/CfjI0=
Emoji are handled correctly via UTF-8.
URL-safe mode
<<??>>
PDw_Pz4-
URL-safe replaces + with - and / with _, and omits padding.
Common Errors & How to Fix Them
| Error Message | Cause | Fix |
|---|---|---|
Invalid character in Base64 string | Input contains characters not in the Base64 alphabet | Remove any characters that are not A–Z, a–z, 0–9, +, /, or =. For URL-safe, use - and _ instead of + and /. |
Invalid Base64 padding | Padding characters (=) are in the wrong position | Padding should only appear at the end. Make sure you copied the complete Base64 string. |
Decoded text is garbled | Original text was not UTF-8 or used different encoding | This tool assumes UTF-8 input. Binary files need the Image to Base64 tool instead. |
Base64 vs Base64url
| Feature | Base64 | Base64url |
|---|---|---|
| Alphabet | A–Z, a–z, 0–9, +, / | A–Z, a–z, 0–9, -, _ |
| Padding | Uses = padding | Often omits padding |
| URL safe | No (+ and / need escaping) | Yes (safe in URLs) |
| Use case | Email, data URIs | JWTs, query strings, filenames |
| RFC | RFC 4648 §4 | RFC 4648 §5 |
Frequently Asked Questions
Is Base64 the same as encryption?
No. Base64 is reversible encoding with no secret key — anyone can decode it. It makes binary data printable, not private. Use AES or RSA encryption when you need security.
Why does Base64 output end with = or ==?
Padding characters ensure the output length is always a multiple of 4. One = means the input had 2 extra bytes after the last complete group; == means 1 extra byte.
What is URL-safe Base64 (Base64url)?
Standard Base64 uses + and / which have special meaning in URLs. URL-safe mode replaces them with - and _, and usually omits padding, so the string works in query parameters and filenames.
Does this Base64 tool support Unicode and emoji?
Yes. Text is encoded as UTF-8 bytes before Base64 encoding, so accented characters, Hindi, Chinese, and emoji all round-trip correctly.
Does this Base64 encoder upload my text?
No. Encoding and decoding run entirely in your browser using JavaScript. Nothing is sent to a server.
Can I encode images with this tool?
This tool is for text. To encode binary files like images, use the Image to Base64 tool which reads raw file bytes.