Developer guide
How to encode text as Base64
To encode Base64 correctly, convert the text to UTF-8 bytes, map those bytes to the Base64 alphabet, and choose the standard or URL-safe form required by the destination.
Open the Base64 EncoderWhat Base64 encoding actually does
Base64 turns bytes into printable ASCII characters. It is useful when a text-only format must carry data that may contain spaces, punctuation, Unicode characters, or binary bytes. It is an encoding, not encryption, so anyone can reverse it.
For text, character encoding comes first. The word café must become UTF-8 bytes before those bytes can become Base64. Treating JavaScript characters as single bytes produces incorrect output for accented letters, emoji, and non-Latin scripts.
text → UTF-8 bytes → Base64 characters
How to encode Base64 step by step
- Copy the exact text, including any spaces and line breaks that should be preserved.
- Choose standard Base64 for general data interchange or Base64url for URL and token contexts.
- Paste the text into the encoder and select Encode Base64.
- Copy the result and keep a note of which alphabet was used.
- Decode a test value when interoperability matters.
The ToolPixels encoder processes UTF-8 text locally in your browser. Standard output uses +, /, and optional = padding. Base64url uses - and _ and omits padding.
A UTF-8 Base64 example
Encoding Hello, ToolPixels! with standard Base64 produces:
SGVsbG8sIFRvb2xQaXhlbHMh
Changing one character, adding a trailing line break, or using a different text encoding changes the bytes and therefore the result. Preserve the original text exactly when another system will compare encoded values.
Standard Base64 or Base64url?
| Format | Use | Key difference |
|---|---|---|
| Standard | Email, files, data formats | Uses +, /, and padding |
| Base64url | URLs, filenames, JWT parts | Uses -, _, often no padding |
Do not assume the two forms are interchangeable. Some decoders accept both, while strict systems reject the wrong alphabet or missing padding.
Common Base64 mistakes
- Encoding twice: the second result decodes to the first Base64 string, not the original text.
- Ignoring whitespace: spaces and line endings inside the input are real bytes.
- Calling it encryption: Base64 provides no confidentiality.
- Encoding a whole data URL: usually only the content after the comma is the Base64 payload.
Use Base64 Encoder in your browser
Use the free Base64 encoder to convert UTF-8 text to standard Base64 or unpadded Base64url without uploading the input.