Using PhotoRec to Recover Deleted Photos from a Memory Card

There are prettier and pricier programs for recovering photos from a memory card, but PhotoRec is a reliable workhorse. And you can’t beat the price.

Text & Photos By David Coleman
Last Revised & Updated:
Filed Under: Memory Cards

I MAY get commissions for purchases made through links in this post.

Okay, so all your photos and videos are gone. Your computer says the card is empty. Yes, I know that sinking feeling very well. Maybe you accidentally formatted the card. Maybe something else has gone wrong. But all isn’t necessarily lost. Depending on what’s gone wrong, there’s a reasonable chance you can recover your photos and videos.

There are quite a few options for software that can recover photos from a memory card. I’ve listed some of the best ones before, which you can find here. Most likely you’ve never looked into them before you really need them. Some of them can be quite expensive. But before you hand over your money, one option that might be worth looking at is PhotoRec. It can look a little intimidating at first, and it doesn’t offer all the bells and whistles of some of the other options, but if you’re looking for reliable, thorough, and inexpensive, it can be a great option. It has been my go-to data recovery tool for years.

Aside from being free, PhotoRec works on just about any operating system, including both Windows and Mac, along with all sorts of digital storage media like memory cards, thumb drives, and hard drives.1 But its not the most user-friendly program out there.

It’s not actually a command-line app in that you don’t have to type in long strings of code to make anything happen. It walks you through the process, but it does it with text-only screens and menus. And it doesn’t prettify things like the names of the memory cards or give you thumbnails of the images and allow you select individual images to be recovered.

In this example, I’m focusing on using it to recover photos from a memory card, but it will also work on just about any other kind of file and on other types of storage media. I’m using a 32GB SanDisk Extreme Pro CompactFlash card that I’ve formatted in the camera to delete all the photos. If you try to see the photos in the camera or on the computer, it’ll say the card is completely empty.

I’m using the Mac version in the examples below, but the versions for the other operating systems work almost exactly the same. There will, however, be some differences in how the media selections are named that is something that relates back to the operating system.

Run PhotoRec

Running PhotoRec is very easy. There’s nothing to install. When you download the package that corresponds to your operating system, you’ll have a bunch of files in a zip file. Just unzip the files to a folder on your hard drive–it doesn’t matter where, so long as you can easily access it. You can even run it off a thumb drive if you like.

Before you run the program, make sure to insert your memory card into the card reader. That will then make it available so that PhotoRec can see it.

Choose the file called ‘photorec’. Double click on it to run it. It will then open a terminal screen. If it asks for your password, enter it. You’ll then get a page that looks like this. This is the page where you choose which memory card (or other device) to work on.

Use the up and down arrow keys to select the media you want to recover from.

You’ll notice you don’t get the pretty volume names you see in Windows Explorer or Finder. You’re seeing the names as the operating system sees them. Nearly all the time, the easiest way to tell one from another is just to look at the size. If you’re trying to recover from a 32GB SD card, then look for the one that’s 32GB. If you don’t see anything that corresponds to what you’re after, close the program and make sure the memory card is properly inserted in the card reader. Open PhotoRec again and see whether it shows up this time. If it doesn’t you might be running into one of the issues described in the note about disk capacity. In that case, it’s time to head on over to the developer’s more granular documentation.

Once you’re highlighting the media you want, use the left and right arrows to move through the menu at the bottom until Proceed is highlighted. Hit enter.

You’ll then move to the next screen that isolates the media you’re working with. You should see the pretty volume name here, which helps confirm that you’ve selected the correct one. You also get information about the sectors and the file system the memory card is formatted with (which is nearly always either FAT32 or exFAT).

You can, if you like, just hit enter here and proceed with searching. By default, PhotoRec will try to recover every non-corrupted file it can find. If that’s what you want, use the left-right arrows to highlight Search and hit enter. If you want some further control over how the operation is done, move across to Options and hit enter.

Recovery Options

You’ll then get a screen like this. These are the default options, and I’d generally recommend sticking with them unless you have good reason to change them. But it’s good to know that the options are available.

To break out of it, hit enter to quit.

Recovery File Options

Options that I use more frequently are the file options. Use the left-right arrows to highlight File Opt and hit enter.

Some other photo recovery software gives you thumbnail previews and you can select to restore individual photos. PhotoRec doesn’t have that option. You can either recover everything or everything of selected file types.

You’ll get a screen that lists an enormous number of file types–currently 440 of them, to be precise. You can use the down arrow to scroll down through the list. The X in the box next to it at the left indicates that it’s selected. By default, they’re all selected. If you want to be comprehensive about it an recover everything you can, leave them all selected and hit enter to quit back to the main screen.

Say you’re only interested in recovering your Nikon’s RAW files, which use an NEF extension, or your Canon’s CR2 RAW files. Press s to deselect all the file types. Then use the down arrow to scroll down to find the filetype you’re after.

But there’s a catch. You’re not going to find NEF or CR2 as separate entries. What you want is TIF. That’s used to cover some RAW formats such as PEF, NEF, DCR, SR2, and CR2.

Scroll down to TIF and hit the space bar to select. Then hit enter to quite back to the main screen.

Run the Search

Back at the main screen, use the left-right arrows to select Search and hit enter.

You’ll then have to tell PhotoRec what kind of file system the photos were stored on. In nearly all cases, memory cards are formatted in FAT, so choose whichever corresponds to that by using the up-down arrows. Hit enter to proceed.

You then get the option of choosing whether to focus only on the “free” space that doesn’t appear in the file allocation table or the whole card. If you’re looking to undelete and recover photos–and, let’s face it, that’s probably why you’re using PhotoRec in the first place–then you probably want to choose Free. But if you want to be more comprehensive about it, you can also work on the whole partition by choosing Whole. Select whichever you want and hit enter to proceed.

You’ll then need to choose the folder on your hard drive you want to save the recovered files to. The up-down arrows move vertically. The left-right arrows drill down (or back). In this example, I’m using a folder called temp. Once you’re in the correct folder and it shows up in the Directory line, press c to proceed. It’s going to start searching immediately once you hit c, so make sure you’re in the correct folder before you do it.

It’s now a matter of sitting back and letting PhotoRec do its thing. It’ll give you a running update of how many files it’s recovered and how long it estimates it will take to complete the task. The time it takes depends on the size of the card, the speed of the card, and the speed of your computer.

Your files are being saved in a subfolder of the location you selected, and you can see them being added in real time.

If you’re already recovered the file or files you’re after, you can stop the process by hitting enter.

You’ll get asked whether you really want to stop or whether you want to resume.

If you hit y, it’ll stop and you’ll get a brief status report. To quit PhotoRec, hit enter once to go back to the original screen, press the right arrow to select Quit Program, and then hit enter. You can then close the terminal screen.

In this example of a Compact Flash card that had been formatted in camera, PhotoRec was able to recover many hundreds of photos. And it’s worth noting that it can recover files not just since the last time you formatted the card, but for many times before that. What it can’t recover is data that has been written over on those specific sectors of memory. But in many cases the data sits there and is often recoverable even after being formatted many times (unless you’re doing a secure wipe on a computer, which writes over the data multiple times).

So that’s about all there is to it. While it can look a little intimidating at first, PhotoRec is actually very easy to use once you get used to the way to navigate through it. And it has saved my bacon on more than a few cases.

Finally, this has been designed as essentially a quickstart guide. If you run into an issue that needs more comprehensive documentation, you can find it on the developer’s site here.

RELATED: How to Recover Photos from a Memory Card


  1. For hard drives, TestDisk by the same developer is a better option. 
Profile photo of David Coleman | Have Camera Will Travel | Washington DC-based Professional Photographer

David Coleman

I'm a professional photographer based in Washington, DC. Seven continents, up mountains, underwater, and many places in between. I've been shooting for 30+ years, and my photos and time-lapse videos have appeared in a bunch of different publications, from major newspapers to magazines and books, billboards, TV shows, professional sports stadiums, museums, and even massive architectural scrims covering world-famous buildings while they're being renovated. You can see some of my travel photography here and here.