What happens when you format a drive?
Formatting rebuilds the filing system your computer uses to keep track of files. A quick format removes the file table and root directory but leaves the file contents in place, so files are often recoverable afterwards. Files become truly gone once new data is written over them, or when TRIM lets a solid state drive clear them in the background.

Formatting does not usually scrub a drive clean. What it does is rebuild the filing system: the set of records your computer uses to keep track of where each file's contents sit on the drive. Microsoft describes the Windows format command as one that creates a new root directory and file system for the disk, and notes in the same breath that it can also delete all data on the disk. Those are two different outcomes, and which one you get depends on the options you choose and on the type of drive you are formatting.[1]
What a quick format actually writes
A quick format is the fast option most tools offer, and it is the one most people get. On Windows, Microsoft documents that the /Q switch performs a quick format: it deletes the file table and the root directory of a previously formatted volume, but doesn't perform a sector-by-sector scan for bad areas. In other words, it removes the index, not the contents. The records that said where each file lived are wiped, and the drive is marked as empty, but the file data itself is usually still sitting on the drive exactly as it was. Because a quick format removes only those records, file contents are normally still present afterwards, which is why files formatted this way are often recoverable until the space they occupy is reused.[1]
Does formatting delete everything?
Not always. A quick format removes the filing system and leaves the file contents in place. The fuller format Windows offers also checks the disk for bad areas, and Microsoft notes that formatting can delete all data on the disk. Apple's Disk Utility states plainly that erasing a storage device deletes everything on it, and SanDisk is blunter still: its support pages describe formatting as data destructive and impossible to undo. The honest answer, then, is that formatting always takes away your access to the files, but whether the contents themselves survive depends on which format you ran and what the drive did next.[1][2][3]
Windows underlines the point before a hard disk format goes ahead: the prompt warns that all data on the disk will be lost and waits for a yes or no answer. That prompt is the last easy exit. If it appears when you were not expecting it, the right answer is usually no.[1]
When your files are still recoverable
Files survive a quick format until something writes over them, and in practice that window is usually generous: an empty-looking drive has plenty of free space to fill before it reaches the old files. Two everyday cases sit here. One is the drive you formatted yourself in a moment of haste and have not used since. The other is the drive that was never really formatted at all. SanDisk lists corrupted file systems, power loss while the drive is in use, unsafe ejection and bad sectors among the causes of the 'you need to format the disk in drive' error, so an operating system demanding a format does not mean the files are gone. SanDisk points people in that position towards data recovery software or a professional service rather than straight to the format button.[1][3]
Step-by-step: recovering files from a formatted USB drive
Step-by-step: recovering photos from a memory card
Related: what happens when you delete a file
When they are not: overwriting and TRIM
Two things genuinely finish the job. The first is overwriting. Writing new data into the sectors a file occupied replaces the contents a quick format left behind, which is what destroys a file rather than merely hiding it. Microsoft's format command has an explicit switch for this: /P zeroes every sector on the volume and can then overwrite it further, and the same documentation notes the switch is ignored when a quick format is requested. The second is TRIM on solid state drives. Microsoft documents a /NoTrim switch that skips sending trim (delete notification) during a format, which tells you a normal format sends that notice, and the drive then clears the blocks behind the removed records in its own time. On an SSD, the drive itself can erase what the quick format left behind.[1]
Apple's guidance for SSDs matches this picture. Secure erase options are not available in Disk Utility for those drives, and Apple suggests enabling FileVault encryption when you start using one instead, so that erasing the drive later means losing the encryption key rather than chasing file contents. For other devices, Disk Utility can write over the erased data several times, but Apple notes the option exists only for some types of storage.[2]
If Windows or macOS asks to format a drive you did not expect it to, stop before agreeing. The message usually means the filing system is unreadable, not that the drive is empty, and formatting before recovery removes the map the files need. Say no first, copy nothing onto the drive, and work out what you would lose before you let anything write to it.[3]
Not sure?
If you are looking at a format prompt, or a freshly formatted drive, and cannot tell which of these situations you are in, the guided help walks through that decision one question at a time. It will not ask for payment or software, and it tells you plainly when a case is one you should not attempt yourself.
Not sure what happened to your drive? Use guided help
Sources
Facts on this page are cited to the publishers’ own documentation.