Base64 Encoder/Decoder
Encode and decode text or files to and from Base64.
Examples
| Input | Result |
|---|---|
| Hello, World! | SGVsbG8sIFdvcmxkIQ== |
| user:password123 | dXNlcjpwYXNzd29yZDEyMw== |
| {"alg":"HS256"} | eyJhbGciOiJIUzI1NiJ9 |
| Line 1 Line 2 | TGluZSAxCkxpbmUgMg== |
About this tool
Base64 encoding converts binary data into a set of 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). This makes it safe to transmit binary content through systems that only handle text, like email protocols or JSON APIs. The trade-off is that Base64 output is about 33% larger than the original data, since every 3 bytes of input become 4 bytes of output.
This tool handles both encoding and decoding in your browser using the built-in btoa() and atob() functions. You can paste text to encode it, or paste a Base64 string to decode it back. File encoding is also supported, which is handy for generating data URIs or inspecting Base64-encoded file contents you have received from an API.
Frequently asked questions
Is Base64 encoding the same as encryption?
No. Base64 is an encoding scheme, not encryption. Anyone can decode a Base64 string without a key. Never use it to protect sensitive data.
Why does Base64 output end with = or == signs?
The padding characters (=) fill out the output to a multiple of 4 characters. Base64 processes input in 3-byte chunks, so 1 leftover byte produces ==, and 2 leftover bytes produce =.
When should I use Base64 encoding?
Base64 is commonly used to embed binary data in text-based formats. Typical cases include embedding images in CSS or HTML, encoding email attachments (MIME), and passing binary data in JSON or XML payloads.
