How it works
Base64 represents bytes using 64 safe characters: A–Z, a–z, 0–9, + and /. Every 3 bytes become 4 characters, and = signs pad the end when the input length is not a multiple of 3. The output is therefore about a third larger than the input.
Base64 works on bytes, not letters, so the tool first converts your text to UTF-8. The browser’s built-in btoa function only accepts characters up to code point 255 and fails on text such as “✓” or emoji; this tool does not have that limitation.
Rules this tool follows
- Encoding follows RFC 4648 with the standard alphabet and = padding.
- URL-safe uses the base64url alphabet from the same standard (- and _ instead of + and /) and leaves out the padding, as JSON Web Tokens do.
- Wrap lines inserts a line break every 76 characters, the limit used for Base64 in MIME email (RFC 2045).
- Line breaks in your input are encoded like any other character.
Example
Input
Hello, World!
Output
SGVsbG8sIFdvcmxkIQ==
Common uses
- Preparing text for systems that only accept ASCII, such as some HTTP headers and data URIs.
- Creating test values for APIs and configuration files.
- Checking what an encoded value should look like when debugging.
Limitations and notes
- Base64 is an encoding, not encryption. Anyone can decode it, so never use it to hide passwords or secrets.
- This tool encodes text. To encode an image or other file as Base64, use a tool that reads files.