How to recover photos from an SD or memory card
Updated
If photos have disappeared from an SD or memory card, or you deleted or formatted it by mistake, there is a good chance they are still on the card. Deleting and formatting mostly remove the card’s index, not the pictures. The pictures stay until new photos are written over them.
So the most important rule is to stop. The free tool PhotoRec, from CGSecurity, can often find the pictures again. This guide walks through it.
First, stop using the card
- Take the card out of the camera. Don’t shoot or delete anything else.
- Don’t format it, even if the camera asks you to.
- If a camera or computer offers to “repair” or “scan and fix” the card, say no. That can write to it.
Every new photo can overwrite one you are trying to save.
Before you start
- A card reader. Many laptops have an SD slot. If not, a USB reader costs a few dollars. Reading the card straight from the camera is slower and less reliable.
- Another drive with room to spare, such as an external drive or a folder on your computer with at least as much free space as the card holds. Recovered files must never go back onto the card.
- Time. A large card can take an hour or more to scan.
- If you can, make a copy (an image) of the card first and work from the copy. PhotoRec can read an image file as if it were a disk. This is optional, but it protects the original if something goes wrong. If you aren’t sure how, skip it. PhotoRec only reads from the card, and CGSecurity says it works in read-only mode.
Recovering with PhotoRec
PhotoRec is free and open source. It runs on Windows, Mac and Linux, and it ignores the card’s file system, so it can work even if the card was formatted or damaged. CGSecurity’s current stable version is 7.2, dated February 22, 2024. A newer beta, 7.3-WIP, is also on its download page.
- Go to cgsecurity.org and open the TestDisk and PhotoRec download page. Download the file for your computer. PhotoRec comes in the same download as a tool called TestDisk.
- Unzip or extract it. There is no installer. It runs straight from the folder.
- Put the card in the reader and plug it in.
- Start PhotoRec with full rights:
- Windows: right-click photorec_win.exe and choose Run as administrator.
- Mac: run photorec in Terminal. It asks for your password.
- Linux: run it with sudo.
- PhotoRec runs in a text screen, with no mouse. Use the arrow keys and Enter. Choose your memory card from the list of disks. Check the size to be sure it is the card and not your computer’s drive. Press Enter on Proceed.
- Choose the partition on the card, or “Whole disk” if it lists none, then choose Search.
- Choose the file system type. CGSecurity’s instruction is: unless it’s an ext2, ext3 or ext4 file system, choose Other. Memory cards use FAT or exFAT, so pick Other. The ext choices are only for Linux drives.
- Choose where to search. Free looks only at the space left by deleted files, and is faster for photos you deleted. Whole searches everything, and is the one to use if the card was formatted or its file system is damaged.
- Choose a destination folder on a different drive. On Windows, select .. to move up to other drives. Mac drives are under /Volumes. On Linux, look under /media, /mnt or /run/media. Press C to confirm.
- Wait. PhotoRec shows how many files it has found. You can open the folders while it runs. When it finishes, it shows a summary.
Recovered files are saved in folders named recup_dir.1, recup_dir.2 and so on. On Windows, CGSecurity advises scanning recovered files for viruses before opening them.
What to expect
Not everything comes back perfectly.
- Names and folders are lost. Files come back with numbers like f123456.jpg. The date a camera stored inside each photo is usually still there, which helps with sorting.
- Some photos come back partly grey or cut off. That happens when parts of a file have been overwritten, or when a file was stored in pieces. PhotoRec rejects files it thinks are invalid. There are options for keeping them and for trying harder with fragmented JPEGs, but the results are mixed.
- You may get extras. Old thumbnails (files starting with t), and photos you deleted long ago, can turn up.
- A card that has been shot on since the loss will give back fewer pictures.
Two notes on how cards fail
- The lock switch. SD cards have a small slider on the side. If it is down, the card is locked and read-only. A locked card isn’t broken, but it can show odd errors. Slide it up before use.
- “RAW” or “Please format the card.” If a computer says the card is RAW, unformatted, or asks to format it, the index is damaged. Say no. Don’t format. PhotoRec can often still find the pictures when you pick Whole.
When to stop and get help
Stop and take the card to a professional data-recovery lab if:
- the computer doesn’t detect the card at all, even with a different reader and port;
- the card is cracked, bent, wet or burnt, or the contacts are damaged;
- PhotoRec finds nothing, or the card keeps disconnecting partway through.
A lab can do things you can’t at home. Say that you stopped using it right away.
If you’re a Photo Organizing Co client
If you’ve lost photos from a card, take it out of the camera and don’t format it. Send me a message before trying anything. I can often run PhotoRec for you and sort what comes back into your library. If your photos are fine, keep the cards as they are and don’t erase them until your library is done and backed up.