Base64 Encode Online: Text and Files in Your Browser
To Base64 encode online here, keep Encode text or file selected and type or paste into the box; the Base64 appears next to it as you type, and Choose file handles binary files. Nothing is uploaded, which matters because the things people encode, such as tokens, certificates and config fragments, are exactly what should not be pasted into a remote service.
What the encoder does with your input
Text is converted to UTF-8 bytes first, then those bytes are encoded. This is worth knowing because encoding is defined over bytes, not characters: the same visible text in a different encoding produces a different Base64 string.
Files are read exactly as stored, with no newline translation. The output therefore matches base64 -w 0 file on Linux byte for byte; plain base64 file produces the same characters broken into 76-character lines.
Padding, wrapping and the alphabet
Standard Base64 output has a length divisible by 4, padded with one or two = characters. Some tools strip the padding; most decoders tolerate its absence, but strict ones do not, so keep it unless a spec says otherwise.
MIME-style Base64 wraps lines at 76 characters. That breaks anything expecting a single-line value — a Kubernetes secret, an Authorization header — so this encoder emits one unbroken line, matching base64 -w 0.
If the value goes into a URL or a JWT you need base64url instead: - and _ replace + and /, and padding is normally dropped.
What encoding costs
Every 3 input bytes become 4 characters, so the output grows by about a third: a 1 MiB PDF (1,048,576 bytes) becomes 1,398,104 characters of Base64. Inside JSON or an email, that growth is paid again on every request and every copy.
Encode when a channel demands text, such as a JSON field, an email or an environment variable, not as a default. For large files, a multipart upload or a plain binary download is almost always the better route.
Frequently asked questions
Does the encoder wrap lines or strip padding?
Neither. The output is a single line with standard `=` padding, the same as `base64 -w 0` on Linux. Strip the `=` yourself only if the receiving format, such as a JWT, requires it.
Why does my output differ from the terminal?
Usually a trailing newline (echo adds one) or line wrapping. Use printf %s and base64 -w 0 to match.
How do I get base64url from this encoder?
Encode normally, then replace `+` with `-` and `/` with `_`, and drop the trailing `=`. The two alphabets are otherwise identical, so there is nothing to re-encode.