How to use the Base64 Encoder & Decoder
- Choose Encode or Decode.
- Type or paste text. To encode a file, select Encode a file instead; it is read on your device.
- For URLs, file names or JWTs, turn on URL-safe to use
-and_instead of+and/. - Copy or download the result. Decoded binary data, such as an image, can be downloaded as a file.
What Base64 is for
Base64 represents any bytes using 64 safe characters: letters, digits, + and /. It lets binary data, such as a PDF or an image, travel through systems that only handle text, like JSON payloads, XML and email. The cost is size: the encoded text is about a third larger than the original.
Base64 is not encryption
Anyone can decode Base64, so it protects nothing. A password that is “only” Base64-encoded, such as in an HTTP Basic Authorization header, is effectively in plain text. That is why Basic authentication must only be used over HTTPS.
URL-safe Base64
The + and / characters have special meanings in URLs and file names. URL-safe Base64 (also called Base64URL) replaces them with - and _, and usually drops the = padding. JSON Web Tokens use it for each of their three parts.
Base64 in Apex
// Text to Base64
String encoded = EncodingUtil.base64Encode(Blob.valueOf('Hello'));
// Base64 back to text
String decoded = EncodingUtil.base64Decode(encoded).toString();
// A file (ContentVersion) to Base64
String fileData = EncodingUtil.base64Encode(contentVersion.VersionData);EncodingUtil.base64Encode produces standard Base64 with padding, the same as this tool’s default. Apex has no built-in URL-safe variant; replace + with - and / with _ yourself if you need it.
Features and limitations
What it does
- Full UTF-8 support, so accented letters, other alphabets and emoji survive the round trip.
- Standard and URL-safe Base64, with or without padding; decoding accepts either automatically.
- Accepts input with line breaks and
data:URI prefixes. - Detects binary results and shows a hexadecimal preview with a download button.
- Clear errors that name the invalid character and its position.
What it does not do
- Files are limited to 10 MB to keep the page responsive.
- It does not encrypt anything. Base64 is an encoding that anyone can reverse.
- Decoded text is assumed to be UTF-8. Text in other character sets shows as binary.