How to decode an email attachment received as a Base64 text

13thOlympian picture 13thOlympian · Oct 13, 2014 · Viewed 29.4k times · Source

I have an email backup file which is purely text. How can I retrieve the document (PDF, images, word files) attached to it as a normal file?

Answer

13thOlympian picture 13thOlympian · Oct 13, 2014
  1. Select the long string of text which appears in your email. That is probably one of the attachments, it usually starts like this:

    --bcaec554d754b0f76a04d9fda578--
    --bcaec554d754b0f77204d9fda57a
    Content-Type: application/pdf; name="test.pdf"
    Content-Disposition: attachment; filename="Otest.pdf"
    Content-Transfer-Encoding: base64
    X-Attachment-Id: 9ba6310dffca527f_0.1
    
  2. Copy this long string and paste it in the Base64 decoder found here.

  3. Download the output and rename it by adding the appropriate extension to it. For example testfile.pdf or filename.docx.

There you go. You just recreated your lost attachment using Base64 decoding.