Base64 Encoder/Decoder
Encode text to Base64 or decode Base64 back to plain text. Handles UTF-8 input.
How It Works
The Base64 Encoder/Decoder converts text to and from the Base64 representation defined by RFC 4648 entirely in your browser. Type or paste plain text in the encoder field to instantly see its Base64 form using the standard alphabet (A-Z, a-z, 0-9, plus, slash) with = padding, or paste a Base64 string in the decoder field to recover the original text. The tool first encodes input text as UTF-8 bytes before Base64-encoding, so non-ASCII characters such as accented letters, emoji, and CJK script round-trip correctly — a common source of bugs when developers naively call btoa on a JavaScript string. Decoding tolerates input with or without padding and silently strips embedded whitespace and newlines that often appear in MIME-wrapped Base64. Errors during decoding (illegal characters, malformed padding) are reported inline so you can spot a copy-paste truncation immediately. Conversion is instantaneous and runs entirely in the browser; the input never leaves your device, which matters when you are inspecting JWT segments, API tokens, or fragments of email attachments that may contain sensitive data.
Use Cases
- Encoding binary data for embedding in JSON or XML payloads
- Decoding JWT header and payload segments
- Preparing data-URI strings for HTML or CSS
- Inspecting Base64-encoded email attachments
Frequently Asked Questions
- Why do I need Base64 if I have plain text?
- Base64 lets you safely embed arbitrary bytes in text-only contexts like JSON, XML, URLs, email bodies, or HTML data attributes that would otherwise mangle binary or non-ASCII data.
- Does this tool support UTF-8 correctly?
- Yes. Inputs are encoded as UTF-8 bytes before Base64-encoding, so emoji, accents, and CJK characters round-trip without corruption.
- What about URL-safe Base64?
- This tool uses the standard alphabet (with + and /). For JWT-style URL-safe Base64 (- and _, no padding), use the JWT decoder which handles that variant automatically.
- Why does my decoded output look broken?
- The most common cause is input that was truncated mid-character. Each Base64 character encodes 6 bits, so missing characters offset the byte boundary for everything after.
- Is my input sent anywhere?
- No. Encoding and decoding happen entirely in your browser via window.btoa, window.atob, and TextEncoder/TextDecoder.