Base64 Encoder and Decoder for Text
Base64 represents binary bytes with a limited set of text characters. It is commonly used where a system needs to carry byte data through a text field, such as an email attachment, a data URL, or part of an API payload.
This browser-based Base64 encoder and decoder works with text input in real time. Your input stays on your device and is not uploaded to an application server.
How to Encode or Decode Base64
- Leave the switch on Encode to convert text into Base64, or move it to Decode to convert a Base64 string back to text.
- Paste or type the value in the input area.
- Read the converted value in the output area.
- Select Copy to copy the result, or Clear to start again.
For example, encoding Hello, World! produces:
SGVsbG8sIFdvcmxkIQ==
The trailing = characters are padding. Depending on the input byte length, a Base64 value can contain zero, one, or two padding characters.
Base64 Is Encoding, Not Encryption
Base64 does not hide or secure information. Anyone can decode it, and the encoded value is usually about one-third larger than the original bytes. Use encryption and appropriate secret-management practices for sensitive data.
Basic HTTP authentication uses Base64 to serialize a username and password, but transport security comes from HTTPS rather than Base64.
Text and Unicode Limitations
This tool uses the browser btoa and atob functions. Those functions operate on byte-oriented strings and do not directly support every arbitrary Unicode character. Emoji and many non-Latin scripts may produce an error unless they are first converted to UTF-8 bytes.
The current tool accepts text only. It does not upload images, PDFs, or other binary files. For binary data, use a file-aware encoder that preserves the original bytes.
Why Base64 Decoding Can Fail
- The input contains characters outside the Base64 alphabet.
- Padding is missing or placed incorrectly.
- The value is Base64URL, which uses
-and_instead of+and/. - Extra punctuation, quotes, or a data-URL prefix was copied with the encoded value.
- The decoded bytes do not represent text supported by the browser conversion.
Related Developer Tools
- Format a JSON payload before inspecting encoded fields.
- Compare encoded or decoded text side by side.
- Preview decoded HTML in a sandboxed frame.