How to hide files within an image
There are quite a lot of methods of encrypting files in the PC and transmit it over the web through e-mails or through different storage media. But the simplest of all without using any encrypting or decrypting tool or without any complex algorithm is to hide the files within an image. And this can be done using the DOS command prompt of Windows. Though this method has it’s pros and cons which we will discuss at the end, it is by far the best method if you do not want others to know what kind of files are carrying.
This encryption method utilizes the command prompt and the copy command in DOS and by using a switch /b it converts virtually any file type into an image. The method is very simple and takes less than 30 seconds. Here are the steps:
- Create a folder on your desktop say Test.
- Put all the files you want to hide inside this Test folder. Say we want to hide file1.txt, file2.mp3 and file3.swf inside an image called wallpaper.jpg. So you need to put all these files inside the Test folder.
- We will need winrar or any file compression utility (required to put multiple files into a single file)
- Create a rar archive of all the files (file1.txt, file2.mp3 and file3.swf) into a single file, say we name it as single.rar
- Now we will hide this single.rar inside the wallpaper.jpg file.
- Click on Start and Run and type cmd, click on Ok to open the command prompt in Windows XP.
- Click on Start and type cmd in the search box and hit enter to open the command prompt in Vista.
- In command window, change the directory to the Test folder. Generally the command prompt opens to the user directory. So in command prompt use Cd desktop to go to the desktop folder and then CD Test to go to the text folder. Now we are in our working directory.
- Here type the following command:
copy /b single.rar + wallpaper.jpg encrypted.jpg
Single.rar is our combined files in rar format and wallpaper.jpg is the image file where we are going to hde the single.rar file. encrypted.jpg (you can use any name of your choice) is the resultant image file that contains the rar file.
The switch ‘/b’ indcates that we are performing the binary copy.
Using this method we can hide virtually any file type like rar, swf, mp3, txt, exe etc within an image. The image file may be a jpg, png, bmp or gif.
Now, when we double click on encrypted.jpg the file will be open in the default image program. So how are we going to see the rar file that we embedded? well, to see the rar file, just rename the encrypted.jpg to encrypted.rar and you can see the content of the single.rar file.
Advantages:
- Supports hiding any file type withing an image.
- No additional tool/software is required.
- Less time and resource consuming.
- You can hide an exe file into jpg and send it through e-mail like gmail, which does not support sending exe files.
Disadvantages:
- It is not a good method for encrypting any important (top secrets) data.
- The resultant image does not open when a file of higher size is hidden inside it.
- Computer forensic tools like EnCase can easily read the file header and determine the true nature of the file.















Comment by Ajay on 22 February 2009:
Actually, this technique is called Steganography
Comment by urt on 23 February 2009:
hey thanks man, that is a very nice thing.
do you know we can hide data in a folder which is not shown only by using some key strokes
Comment by khaled on 23 February 2009:
Hi that’s a good idea certainly for sending files via email, .zip files sometimes get blocked. I tried making a zip file renaming it to .jpg then converted back to .zip and sure enough all the files were intact. On a different not, Not sure if you have heard of Woopra, but just discovered it and may be worth you having a look.
Comment by Ash on 23 February 2009:
The info you have given here really makes my head spin, keep it going
Comment by Tlonster on 23 February 2009:
So if we don’t change the name of the file to .rar or .zip we cannot see the content of the image by double clicking on it?
Comment by John Mann on 23 February 2009:
Very interesting article. I’m amazed at what can be done with a simple image file.
Comment by Sebastien on 24 February 2009:
Cool tip. Thanks for sharing. Always good to know.
Comment by Scott on 24 February 2009:
Haha, that is awesome…. I love techie stuff like this. Makes you feel like a little hacker even though its such a novice trick.
Should be fun to use on my friends and family.
Comment by Ajay M on 25 February 2009:
I am very much aware of Woopra and using it currently.
Comment by Ajay M on 25 February 2009:
if you will be more specific about what exactly you want, I think I have a solution for you.
Comment by Steeve on 25 February 2009:
another nice handy tips..
I still remember the days where I used to modify the header hex to prevent people from opening my files in their right formats, people thought they were corrupted and I just corrected them when I needed them.
Comment by Hans Andersen on 25 February 2009:
That was news for me. But could be a very good idea to avoid spam-filters.
Comment by aniroy1986 on 26 February 2009:
this is useful trick. i hav tested it before. only way ordinary users can suspect is looking at the file size. the file size remains the same as the original which is far bigger than common image size in most cases.
Comment by family tents on 27 February 2009:
Thats something to think about and very interesting. Thank you for sharing this information:))
Comment by Flex L on 27 February 2009:
Is there a way to send the email so that an exe file starts when opened? I bought a laptop and my son is now using it for school. I think he may be using for something he shouldn’t. I don’t want to get into that but I would like to add a keylogger. He knows more about computers than me and has it password protected and with him all the time. Email without him knowing is my only thought. Any help? You can mail me direct at MrJuice90@yahoo.com Thanks
Comment by hypavera on 28 February 2009:
I think this could be very useful especially for e-mailing. Thanks.
Comment by Dave on 3 March 2009:
Cool tip. Thanks for sharing. Always good to know.
Comment by Folk Art on 10 March 2009:
that’s a nice tip i need to try it myself, thank you for sharing and good luck at your next posts Ajay!
Comment by Billigflug on 11 April 2009:
Great, I have follwed your instructions, it works
You have really made my life easier. In fact i couldn’t send an exe file via Gmail, that doesn’t support sending exe files. I was searching for a software that supports this feature but didn’t found a free one.
I’expecting more useful tips from you.
Sorry I can’t write in spanish because I’m learning it just since 6 monthes, I hope you understand it.
keep up blogging.
Comment by sayasatria on 20 May 2009:
Great tip. Thanks for sharing. actually I have find this tips for a long time and find it here. Happy to found your blog.
Thanks.