Base64 Text Encoder and Decoder
Encode UTF-8 text or decode Base64 and Base64URL with validation for alphabet, padding and text.
Choose the right Base64 alphabet and diagnose decoding failures
Estimate encoded size from bytes
Base64 represents every three bytes with four characters. In standard padded form the length is four times the number of three-byte groups, rounded up. A final partial group uses padding. RFC 4648’s Base64 and Base64URL definitions explain the alphabets and padding rules.
A character can occupy multiple bytes in UTF-8. A and é each appear as one character, but é occupies two bytes. The examples below can be reproduced in the text encoder. Base64URL mode emits unpadded output and replaces plus and slash if they occur.
| Input | UTF-8 bytes | Standard Base64 | Base64URL |
|---|---|---|---|
| A | 1 | QQ== | |
| é | 2 | w6k= | w6k |
| ÿ | 2 | w78= | w78 |
| 💡 | 4 | 8J+SoQ== | 8J-SoQ |
Check alphabet, padding and decoded byte type in that order
Use the alphabet documented by the receiving system. A valid Base64 string can still represent an image or other binary data. For example /w== decodes to the byte FF, which is invalid UTF-8 by itself. The tool rejects this because its output is text. See the WHATWG Encoding Standard for UTF-8 decoding rules.
Encoding happens in the browser and increases the amount of data for ordinary nonempty inputs. Anyone with the encoded string can reverse it. Use fictional values when debugging and avoid pasting credentials, tokens or private files.
Editorial review
Calculation method
Select standard Base64 for an ordinary padded encoding. Use Base64URL mode when the consumer expects hyphens and underscores instead of plus and slash. The decoder validates padding and checks that the decoded bytes are UTF-8.
Unicode text → UTF-8 bytes → Base64 alphabet. Decoding reverses the sequence.Assumptions and limits
Base64 is reversible encoding. It provides no encryption or password protection. The tool works with text up to 200,000 characters and rejects non-UTF-8 decoded files.