Posted with permission from Popular Science

Don't trash them right away.

code
You don't have to be a software expert to repair a recalcitrant file.

What happens when you download a PDF that then refuses to load, or you open a video only to find it won't play? Being unable to open files as usual is one of the most frustrating tech problems you're likely to encounter. But you shouldn't give up and delete them right away. Most of the time, the following tricks will let you fix the issue yourself.

Find the cause

All kinds of problems could be making that file refuse to open. Maybe the file has become corrupted, or someone saved it in an incorrect format, or you're simply opening it with the wrong program. A bit of detective work at the beginning can help you work out what the problem is. From there, you can choose the best way to solve it.

The message you see when you try and open the file will give you some clues. If you double-click on an item that's categorized with an unrecognized file type, a Windows computer will ask, "How do you want to open this file?" and a macOS machine will say, "There is no application set." Both operating systems will then give you options for finding applications that can open this mysterious format. Within a specific program, if you try and open a file that the software can't read completely, you might see messages about unreadable content or invalid file types. This confusion could indicate that the file is corrupted or has the wrong file extension added to it.

If you're not sure what kind of file you're dealing with, a couple of online tools can help. CheckFileType and Online TrID File Identifier both let you upload a file in your browser and then identify the mystery item. Once you know the file type, you can find a program capable of accessing it. As always, be wary of opening files you aren't sure about or that have come from suspicious sources.

Change the file extension or format

A file extension is the three or four-letter code after the dot in its name. For example, a musical file's extension will be the ".mp3" that appears at the end. Some files show up without these codas, but you can force them to appear. On Windows, go to Windows Explorer, navigate to the View tab, and tick the File name extensions box. On macOS, choose Finder then Preferences, go to the Advanced tab, and tick Show all filename extensions.

A file's format is the way it was encoded or saved to the disk—as the aforementioned MP3 file, or a PowerPoint presentation, or a video. The file extension described above acts as the signifier or label for the file format, so these two must match up. Otherwise you're going to run into problems when opening files. To change a file extension on Windows or macOS, just click on the file and edit the last three or four letters to show the correct extension for the format.

Modifying the extension doesn't actually change any of the file's contents, but it can make a file recognizable to the applications on your system, thus helping you open it. For example, your image editor may not know what "picture.ipg" is supposed to be, but it will open "picture.jpg" with no problem. If the file extension has been mislabeled for whatever reason, then editing it creates an easy fix.

Changing the file format is trickier; it involves saving the file again using a different set of standards. Generally speaking, to alter a file's format, you'll need to open it in some kind of application—so this isn't going to work for files that have been damaged. This is more of a fix for files that won't open in your favorite image editor or word processor, but will open in an alternative program. Say a colleague has typed a document in the Mac program Pages, giving it the .pages extension, and then sent the file to you. You may not be able to open the document in Microsoft Word, so if you prefer that word processor, you must change the format: Open the document inside Pages, hit File and then Export To, and save it in Word format with a .doc or .docx extension.

So if a file doesn't open in one application, try cracking it open with a different application and then modifying the file format. For instance, the free HandBrake program, available for both Windows and macOS, can covert one video file into another file type, so if you can't open a video on your computer or smartphone, HandBrake might be able to convert it into a format that will work. If you don't care about the video application—you just want to watch your file— try the free and well-known VLC Media Player, which can play just about every video file format out there. Similarly, you can open almost any image format with IrfanView, as long as the file has been correctly encoded.

Repair damaged files

These techniques—editing file extensions, changing formats, and trying different apps—will only get you so far. In order to rescue truly corrupted files, you'll need a dedicated repair tool. These programs typically focus on one particular file format, so you'll need one tool to fix a word-processor document, another to unscramble a video, and so on. To figure out which type of repair program you'll need, check out the extension and any other information you can find about the file.

Because of the sheer number of file types, we won't cover repair tools for all of them right here. However, a quick online search (keep your keywords as specific as possible) should turn up some leads for whatever format you're dealing with. Be sure to check out free and official options first before paying for a program. With Word docs, for example, try Word's own repair tool before anything else. Don't shell out cash for a repair tool unless you've exhausted all of your other options, AND you've read user or professional reviews that suggest it can work for you. For advice on repairing documents, videos, and PDFs, read on.

For Word documents, which often get damaged, here's how to use the repair feature built into Microsoft Word. Launch the program, click Open Other Documents, and then choose Browse. Select your problem file, click the down arrow next to the Open button, and choose Open and Repair from the list. For the other Microsoft Office applications, such as Excel and Powerpoint, you can access similar tools in the same way.

Another frequently-damaged file type is video. We've mentioned HandBrake and VLC Media Player, but while they can convert between formats and open many different video types, they can't repair corrupted video files. As far as your free options go, Recover MP4 fixes only a limited number of problems...and that's about it unless you're willing to pay. In that case, Grau GmbH Video Repair Software (from about $35) and Stellar Phoenix Video Repair (from $69.99) have good recommendations, and they also offer free demos. Before you pay up, give the demos a whirl to see if they work for you.

PDFs also frequently get corrupted during their creation or when you're downloading them. Two free online services, Repair PDF and PDF Tools Online, might be able to bring your document back from the digital grave. If they fail, download PDF Repair Toolbox ($27 for Windows only). It lets you run a test on your damaged file before charging you for the full software.

Unfortunately, some files become damaged beyond repair—you won't be able to fix them all. Sometimes, your only option is to return to that file's source, whether it's a music service or the colleague who emailed you a document, and download a new copy. In some cases, you might even have to bite the bullet and create your own new file from scratch.