Base64 text encode / decode
Encode text to standard Base64 or base64url from UTF-8 bytes, or strictly decode back. Chinese and emoji round-trip intact; illegal characters, bad padding, non-canonical trailing bits and invalid UTF-8 all raise explicit errors.
Inputs and parameters
input— Input text (UTF-8)mode— Mode
Real example
mode=encode, input=你好 🚀
→ 5L2g5aW9IPCfmoA= (choose decode with it to recover 你好 🚀; input !!! raises INVALID_BASE64)
Limits and failure handling
Text only, no binary files or images. Standard decoding requires correct = padding; base64url uses the -_ alphabet and rejects +/. Internal whitespace, non-canonical aliases (e.g. YS==) and invalid UTF-8 are rejected. Input cap 1 MiB.
FAQ
Will Chinese text break?
No. TextEncoder produces UTF-8 bytes first; decoding uses a fatal TextDecoder so invalid bytes raise INVALID_UTF8.
Are Base64 images / data URLs supported?
No. This operation handles text only: no data: prefix parsing and no binary download; the 1 MiB cap counts UTF-8 bytes.