Base64 Encode & Decode — Convert Text in Your Browser
Convert text or file bytes to Base64 and back in your browser. Steps: pick Encode or Decode, paste text or choose a file, toggle Base64url if needed, then copy. Example: Hello 世界 → SGVsbG8g5LiW55WM. Handles Unicode via UTF-8; nothing is uploaded.
How it works
Choose Encode to turn UTF-8 text or file bytes into Base64, or Decode to reverse it. Unicode is handled via UTF-8 bytes before btoa. Enable Base64url for JWT-style output (- and _ instead of + and /, no padding). File input reads bytes locally — no upload.
Rules you should expect
What to expect when encoding or decoding: alphabet variants, UTF-8 handling, padding, and file vs text input.
- Standard Base64 alphabet: A–Z, a–z, 0–9, +, /. Output length is a multiple of 4 with = padding as needed. Base64url swaps +→- and /→_ and often omits =.
- Text is always UTF-8 encoded before Base64. One Unicode character may become several Base64 characters (e.g. 世界). Decoding restores the original string when input is valid.
- File encode reads raw bytes — useful for checksums, attachments, or binary blobs. Text encode and file encode share the same output panel; file mode clears the text area and shows a file info banner.
- Privacy: no server upload. This tool uses zero external libraries — conversion stays entirely in the browser per RFC 4648.
Example
Encode (standard): Hello 世界 → SGVsbG8g5LiW55WM. Encode (Base64url): same bytes → SGVsbG8g5LiW55WM (no +/=). Decode reverses either form back to Hello 世界.
Good fits
- Developers: encode JSON or UTF-8 strings for API bodies, data URLs, or test fixtures.
- JWT / OAuth: produce or inspect Base64url segments before pasting into a JWT decoder.
- Config / DevOps: embed small binary blobs or secrets as Base64 in YAML, env files, or CI variables.
Frequently asked questions
What is the difference between Base64 and Base64url?
Standard Base64 uses A–Z, a–z, 0–9, +, /, and = padding. Base64url (RFC 4648 §5) replaces + with - and / with _ and usually drops padding — common in JWT and URL-safe tokens.
Does this support Unicode / UTF-8?
Yes. Text is encoded as UTF-8 bytes first, then Base64. Decoding produces the original Unicode string. If you see mojibake, the input may not be valid Base64 or was encoded with a different charset.
How is this different from Image ↔ Base64?
This page handles general text and raw bytes plus Base64url. Image ↔ Base64 focuses on photos — preview, MIME type, and download — not arbitrary UTF-8 strings.
Does my text or file leave the browser?
No. Conversion runs entirely in your browser with TextEncoder, btoa/atob, and FileReader. Your paste and files never leave the device.
What happens with invalid Base64 input?
Whitespace is ignored when decoding. Invalid characters, bad padding, or truncated strings throw an error. Very large pastes (>1M chars) may feel slow — try a shorter excerpt.
Questions or feedback
Something unclear, broken, or missing? Draft a message below — we read every note about these tools.