Quick Links

Corrupted files don't happen too often on modern computers with good security measures in place. But when they do, it can be a nightmare. Let's take a look at the common causes of corrupted files, how you can help prevent them, and what you can do when it happens.

Why Do Files Become Corrupted?

windows-8-blue-screen-header

Usually, files become corrupted when being written to a disk. This can happen in various ways, the most common of which is when an app suffers an error while saving or creating a file. An office app might suffer a glitch at the wrong time while saving a document. A compression app may experience problems while creating an archive. Your backup app may have problems when writing out your backup. Your browser (or other download app) may even have problems writing a downloaded file to disk.

Often, these apps will notice the error and let you know that something went wrong, giving you the chance to try again. Sometimes, though, you'll have no idea that something went wrong until you try to open the file later.

There are, of course, other reasons that files can become corrupt, as well.

When you shut down your computer, it is supposed to close out any files it has open properly (or give you the chance to do so). When this doesn't happen---like, say, if you lose power or if your computer crashes---it doesn't have the chance to close files the right way. This can lead to the corruption of any files that were currently open, including not just your documents, but even operating system files.

Related: Bad Sectors Explained: Why Hard Drives Get Bad Sectors and What You Can Do About It

Problems with your hard disk can also lead to corrupted files. Sometimes, like in the case of a bad physical sector on the drive, your corrupted file may be part of a much larger problem. Sometimes, smaller errors---like a cross-linked file or lost cluster---are the culprit in your file corruption problems and are not necessarily indicative of a failing hard disk.

And finally, of course, malware and viruses can also cause corruption, though in that case, it's more intentional than accidental.

How to Protect Against Corrupted Files

Related: What's the Best Way to Back Up My Computer?

First and foremost, the single best thing you can do to protect yourself against corrupted files is make sure you're backing your computer up regularly. And note that cloud storage and other file syncing options may not be enough to get the job done. If you have a corrupt file on your local disk that then gets synced to your cloud storage, you don't really have a good backup of that file. If you do rely on cloud storage, at least make sure that you have the option to recall previous versions of files (like in Dropbox).

It's always best to use a true backup solution like File History (on Windows), Time Machine (on macOS), or Backblaze, all of which allow you to restore multiple previous versions of files.

Next up on the prevention checklist, make sure that your computer is protected from viruses and malware. This includes not only running a good antivirus app, but using common sense when browsing and downloading.

Related: How to Select an Uninterruptible Power Supply (UPS) for Your Computer

And finally, you might want to consider investing in an uninterruptable power supply (UPS) to help protect your computer from sudden shutdowns when you lose power. A UPS works as a battery backup that provides you a buffer against power loss. Typically, they can supply your computer with anywhere from a few minutes to an hour or more of power, giving you ample time to shut your computer down properly. Having a good UPS can not only help prevent corrupted files from a bad shutdown, but the hardware problems they can cause, as well.

What Can You Do When a File Is Corrupted?

If you have a corrupted file, your best bet is to try grabbing that file from the source again. Download it again, if that's where you got it, or have someone resend the file to you.

Related: How to Repair Corrupted Windows System Files with the SFC and DISM Commands

In the case of corrupted system files (from an unexpected shutdown, bad update, or malware), you can always try something like Windows' built in System File Checker. It scans your system for corrupted system files, and then replaces them with originals.

Before you do that, though, it's best to try fixing the cause of the problem. In the event of malware, you should first make sure you've removed that malware from your computer. If you suspect a bad update caused the problem, you might be able to roll that update back.

If your corrupted file is a document that you've created, unfortunately, your options are limited. Some apps (like those included with Microsoft Office) autosave multiple versions of your document, letting you open a previous version if the current version becomes corrupt.

Related: How to Recover a Lost or Corrupt Document in Microsoft Word 2016

If you don't have the luxury of opening a previous version, you may be able to repair the file or, at the least, recover the text from it. Again, Microsoft Office apps offer built-in tools for recovering lost or corrupted documents, as do some other programs. Even if you can only recover the text from a document, you can save a lot of time when recreating the file.

There are also a number of apps out there that claim they can recover different types of corrupt files. Some are free and some are paid, but the truth is, most don't work very well. And a few that we tested were bloated with companion apps or, worse, malware. Given that, we recommend just not using them.