Base64 Encoder/Decoder
Encode text or a file to Base64, or decode Base64 and a data URL back into readable text or a downloadable file.
0 characters of text.
How to encode and decode Base64
Convert text or a file to Base64, or decode Base64 and data URLs back into text or a downloadable file.
What Base64 is for
Base64 turns arbitrary bytes into plain ASCII text, using 64 characters (A-Z, a-z, 0-9, + and /). It is commonly used to embed small images or files inside JSON, CSS, or HTML, since those formats cannot hold raw binary data.
Text mode
Encode turns the text in the left box into Base64 in the right box. Decode does the opposite: it reads the Base64 in the right box and, if it is valid, replaces the left box with the original text.
File mode
Encoding a file produces a data URL, the file's MIME type followed by its Base64 content, which can be pasted directly into an image tag's src or a CSS url(). Decoding accepts either a data URL or plain Base64 together with a file name and MIME type, and rebuilds the original file for download.
How to use it
- Switch between the Text and File tabs depending on what you are converting.
- In Text mode, choose Encode or Decode to convert between the two boxes.
- In File mode, drop a file to encode it, or paste Base64 or a data URL to decode and download it.
Encoding notes
Base64 expands data by about one third, so it is best for small payloads, snippets, and data URLs rather than large file transfer.
FAQ
Is Base64 encryption?
No. Base64 only changes how bytes are represented as text; it provides no confidentiality. Anyone can decode it back to the original content.
Why does decoding fail with an error?
The pasted text is either not valid Base64 (wrong characters or padding) or it decodes to bytes that are not valid UTF-8 text. File mode still works from the same input, since it decodes to raw bytes rather than text.
Does encoding a file increase its size?
Yes, by roughly a third. Base64 represents each 3 bytes of the original file with 4 text characters.
Can I use this for large files?
It works well for typical images and documents, but very large files can be slower to encode or decode as text in the browser.
