Base64 encoder/decoder
Type text to turn it into Base64, or paste Base64 to decode it. Arabic and emoji are handled through UTF-8, the input is validated before decoding, and you are told when the result is binary data rather than text. Remember that Base64 is an encoding anyone can reverse, not encryption. Use it to Base64 decode a string, or to Base64 encode text, images and other files.
Loading the tool…
Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.
How to use it
- Choose “Encode” or “Decode”.
- To encode, type the text or choose a file (up to 5 MB). To decode, paste the Base64 text; a link starting with data: is accepted too.
- When encoding, pick what you need: the URL-safe alphabet, no = signs at the end, or a data URI.
- Read the notes: data size, which alphabet was detected, and any problem with padding or characters.
- Copy the result or download it. If the result is binary data, download it as a file instead of viewing it.
Example
The word مرحبا becomes 2YXYsdit2KjYpw==. It is five letters but 10 bytes in UTF-8, and every 3 bytes become 4 symbols, so the result needs two = signs at the end.
The text SGVsbG8 (with no = at the end) decodes to Hello with a note that padding was missing and one = was added. SGVs*bG8= is refused because the * at position 5 is not in the Base64 alphabet.
Limits and caveats
- Base64 is an encoding, not encryption: it does not protect passwords or sensitive data, and anyone can decode it instantly.
- Files are limited to 5 MB and pasted text to 2,000,000 characters. Measured in Chromium on a desktop computer: encoding a 5 MB file took under two seconds. When the result is longer than 100,000 characters only the beginning is displayed; copy and download include the full result.
- Decoded text is assumed to be UTF-8. If the bytes are not valid UTF-8 (an image, an archive, or text in a legacy charset), no garbled text is shown: you get the file type when it is recognised, the first bytes, and a button to download them.
- Only a few file types are recognised from their signature: PNG, JPEG, GIF, WebP, PDF, ZIP and GZIP. Anything else downloads with a .bin extension.
- Decoding accepts the standard and URL-safe alphabets, wrapped lines, and missing padding (with a note). It refuses mixed alphabets, foreign characters, a = in the wrong place, and lengths that no correct encoding can produce.
- A data URI always uses the standard alphabet with padding, so “URL-safe” and “No padding” are ignored when it is on.
Questions about this tool
Is Base64 encryption? Can I use it to hide a password?
No. Base64 is a way of writing bytes as text characters so they pass through places that only accept text. There is no secret key, and anyone can decode it with this tool or any other in a second. Do not use it to protect anything.
Why did other tools produce strange symbols with Arabic text?
The browser’s old btoa function treats every character as a single byte, so it fails on, or corrupts, Arabic letters. This tool first turns the text into UTF-8 bytes with TextEncoder and then encodes the bytes, and it reverses the same steps when decoding.
What is URL-safe Base64?
The same alphabet with + replaced by - and / replaced by _, so the result can go into a URL or a file name without further encoding. The = signs at the end are usually dropped. JWT tokens use it, for example.
How do I decode Base64 to text?
Choose “Decode” and paste the Base64: the original text appears, decoded with correct UTF-8. SGVsbG8= decodes to Hello, and 2YXYsdit2KjYpw== decodes to مرحبا. If the bytes are an image or another file rather than text, the tool shows the file type when it recognises it and offers a download.
How do I encode a file or an image to Base64?
Choose “Encode”, then choose the file (up to 5 MB), and the Base64 text is ready to copy or download. To embed it directly in HTML or CSS, turn on “Output a data URI” and the result for a PNG image starts with data:image/png;base64,. Base64 makes data about a third larger, because every 3 bytes become 4 characters.
