About the Base64 Encoder / Decoder
Base64 represents binary data such as images and files using only 64 characters: AโZ, aโz, 0โ9, + and /. It is used everywhere: email attachments, Data URLs that embed images in HTML and CSS, JWT tokens and HTTP Basic authentication headers.
This tool encodes text as UTF-8, so accented letters and emoji produce exactly the same output as Python, Java or Node.js. File conversion also runs entirely in your browser; nothing is uploaded.
How to use
- On the Text tab, choose Encode or Decode and type into the box. The result appears instantly.
- Turn on URL-safe for values that go into URLs or file names: + and / become - and _, and the trailing = is dropped.
- If decoded data is an image or other file, a preview and a Save as file button appear.
- On the File / image tab, turn a file into a Data URL, CSS rule or img tag, or turn a Base64 string back into a file.
Worked examples
Build an HTTP Basic auth header
- Input
user:pa$$w0rd(Encode, URL-safe off)- Result
- dXNlcjpwYSQkdzByZA==
13 bytes โ 20 chars
The header is then Authorization: Basic dXNlcjpwYSQkdzByZA==. Anyone who sees the header can decode it, so Basic auth is only safe over HTTPS.
Read the payload of a JWT
- Input
eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ(Decode)- Result
- {"sub":"1234567890","name":"John Doe","iat":1516239022}
55 bytes
JWT segments are URL-safe Base64 without padding; the decoder accepts them as they are. Paste the iat value into the Unix timestamp converter to see when the token was issued. Decoding does not verify the signature.
A stray character from copy and paste
- Input
SGVsbG8@V29ybGQ(Decode)- Result
- Invalid Base64 character '@' (character 8)
Chat apps and word processors sometimes add or swap characters. If you paste the Base64 of a PNG instead, the tool says "This is PNG file data, not text" and shows a preview with a save button.
Base64 is not encryption
Base64 is just an encoding that anyone can reverse instantly; it does not hide anything. Storing or sending passwords or personal data as plain Base64 is not secure. Use encryption such as AES to protect content, and a hash such as SHA-256 to detect tampering.
Size and variants
| Item | Details |
|---|---|
| Size | Every 3 bytes become 4 characters, so output is about 33% larger |
| Padding (=) | 0โ2 = signs are added to make the length a multiple of 4 |
| URL-safe | + โ -, / โ _ and = usually omitted (JWT, RFC 4648 ยง5) |
| Data URL | data:image/png;base64,โฆ can be used directly in HTML and CSS |
Non-ASCII characters take 2โ4 bytes in UTF-8. For example, "cafรฉ" is 5 bytes and encodes to Y2Fmw6k=.
FAQ
Why do some characters look garbled after decoding?
The original was probably encoded in a legacy charset such as Windows-1252 or ISO-8859-1 rather than UTF-8. This tool decodes as UTF-8; data that is not valid UTF-8 is treated as binary and offered as a file download.
Should I embed images as Base64?
For tiny images such as icons (a few KB) it can save HTTP requests. Larger images grow by 33% and can't be cached separately, so they usually load slower. A common rule of thumb is to inline only images under about 10 KB.
Can it decode Base64 with line breaks or spaces?
Yes. Whitespace and line breaks are ignored automatically, and URL-safe characters (-, _) and missing padding (=) are handled too.
Is there a file size limit?
Conversion happens in your browserโs memory, so file to Base64 conversion supports files up to 50 MB.
Why does another tool give a different ending for the same text?
Usually it is the URL-safe setting. For example "Hi?>>" is SGk/Pj4= in standard Base64 and SGk_Pj4 in URL-safe Base64. Use URL-safe for URLs, file names and JWTs, and the standard alphabet for email, Data URLs and HTTP headers.