A Base64 Decoder is a program that translates base64 encoded data back to its natural form. Base64 is an encryption algorithm often used for transmitting attachments in emails. I wrote this tiny tool because my email client doesn't support attachments -- it displays attached files as base64 encoded data in the message body. So I decided to write a decoder that allows me to extract the attachments out of the messages and to save it as files. It's a pretty simple and small program, but -- without it, I couldn't extract my attachments :)
B64Dec is not capable of parsing MIME headers. Instead of this, you have to manually copy-and-paste the base64 data out of the message body into the decoder.
Under Windows XP, B64Dec runs optimal. Under Windows 95/98, B64Dec cannot open files greater than 64 KB. This is due to limitations of the operating system (the Windows 95/98 multiline edit component is restricted to 64 KB).
You can use B64Dec from the command line by specifying the source and destination files. The syntax is as follows:
b64dec *C | "source-file" ["destination-file"]
With this syntax, B64Dec expects the base64 encoded string in the clipboard. It will decode and save it back to the clipboard. The return value contains either a negative error code or the size of the decoded string.
C:\>b64dec encoded.txt dest.txt
This decodes "encoded.txt" to "dest.txt". The program window will not show up.
You can omit the "destination-file" parameter. In this case,
B64Dec will generate a destination file name based on the source file name. It
consists of a random number, followed by the source file name; that means that
the command "
b64dec encoded.txt" could generate a file named
If used by command line, B64Dec returns an exit code. If the exit code is positive, it indicates the size of the decoded data (in bytes). If the exit code is negative, it is an error code. The following error codes exist:
|-1||illegal characters in input data|
|-2||not enough memory|
|-3||could not read from source file|
|-4||could not write to destination file|
The following DOS-style batch code could be used to call the decoder from the command line:
b64dec %1 %2
if errorlevel 0 exit /B
if errorlevel -1 goto illegal
if errorlevel -2 goto memory
if errorlevel -3 goto source
if errorlevel -4 goto dest
echo illegal characters in input data
echo not enough memory
echo could not read from source file
echo could not write to destination file
B64Dec is freeware. You may distribute it freely, but only in the original and unchanged b64dec.zip file and NOT ON YOUR OWN WEBSITE. FREEWARE DOES NOT MEAN PUBLIC DOMAIN OR OPEN SOURCE. I hold all rights.
Feedback is always appreciated, especially if you encounter any bugs.