Base64 Encode/Decode Online — UTF-8 Safe
Encode text to Base64, decode Base64 to text. UTF-8 safe (Unicode handled correctly), URL-safe mode for query params. 100% client-side.
Why use this tool
btoa/atob only handle Latin-1. The tool uses TextEncoder/TextDecoder to handle emoji + Vietnamese + Chinese correctly.
Replaces + / = with - _ '' so it can be used in URLs/JWT/cookies.
Pasted tokens / API keys are not uploaded anywhere. Encode/decode runs locally.
How to use
- 1Pick mode: Encode (text → Base64) or Decode (Base64 → text).
- 2(Optional) Toggle URL-safe mode if needed.
- 3Paste input, click action. Output appears on the right with a copy button.
What is Base64?
Base64 is an encoding that turns binary data into 64 ASCII characters (A-Z, a-z, 0-9, +, /). Common uses: data URLs, JWT tokens, email attachments (MIME), HTTP basic auth, CSS-embedded images.
URL-safe Base64 (RFC 4648 §5) replaces + → -, / → _, drops = padding — usable in URL query params without URL-encoding.
- ✓UTF-8 safe (TextEncoder/TextDecoder)
- ✓Standard Base64 + URL-safe variant
- ✓Bidirectional encode/decode
- ✓Auto-detects padding
- ✓Native btoa/atob backbone
- ✓100% client-side
FAQ
Why can't native btoa() decode emoji?
btoa/atob spec only accepts Latin-1 (0-255). Emoji is multi-byte UTF-8 → throws InvalidCharacterError. The tool wraps with TextEncoder to bypass.
Is Base64 encryption?
NO. Base64 is encoding (reversible). Anyone can decode it. Don't use Base64 to 'secure' a password — use hashing or encryption.
Can I upload a file to encode?
Phase 1 is text only. File support (drag-drop image → data URL) is Phase 2.