Old computers often end up sitting in a closet or getting donated or thrown out without anyone thinking about the data still on them. A hard drive from a discarded computer can be read by anyone who has the right tools, and that data can include saved passwords, financial documents, photos, and anything else that was on the machine. Disposing of a computer properly takes a few extra steps but protects your information.
Before you do anything else, copy any files you want to keep to an external drive, USB drive, or cloud storage. Once you wipe the drive, the data is gone.
Sign out of your Apple ID, Microsoft account, Google account, and any other accounts on the computer. On a Mac, go to System Settings, click your name, and select Sign Out. On Windows, go to Settings, then Accounts, then Your info, and choose Sign out. Deauthorize iTunes or any music or software that ties to a device limit.
Windows: Go to Settings, then System, then Recovery. Click Reset this PC, then choose Remove everything, then Local reinstall. This reinstalls Windows and removes your data. When prompted, select Change settings and enable data erasure for a more thorough wipe.
Mac: On Apple Silicon Macs, go to System Settings, General, then Transfer or Reset, then Erase All Content and Settings. On older Intel Macs, restart in Recovery Mode by holding Command+R, then use Disk Utility to erase the drive before reinstalling macOS.