Almost all home Wi-Fi routers have a reset button located on the back or bottom of the unit. It's often got a red ring around it. Use a straightened paper clip or a pen to press that for several seconds, and your router will be restored to its out-of-the-box condition, including the default usernames and passwords, but without that pesky malware.
There are some caveats. In some cases, you have to hold down that button for 30 seconds for the reset to take effect. What you're looking for is blinking lights on the device that indicates it is ready for a brand-new setup.
For really difficult cases, try the "30/30/30" method: Hold down the reset button for 30 seconds, keep it pressed while you unplug the router from the power source for 30 more seconds, and then plug it back in while keeping the button held down for an additional 30 seconds.
And, of course, there are a few models with no reset button at all. We'll get to those below.
But you need to remember a few things, no matter which brand or model of router you have.
One: Write down the access passwords and network names for all networks created by your router BEFORE your factory-reset it.
Use the same network names and passwords after you set it back up, and you won't need to change the Wi-Fi settings on your computers, smartphones, tablets, game consoles, smart TVs and so on.
Many of the routers' administrative interfaces let you back up a configuration file, which will contain the passwords and network names, to a PC or Mac before you perform the factory reset. We've got more-detailed instructions about using the administrative interfaces here.
Two: Change the default administrative username and password straight away after you reset the router.
Don't ever leave those untouched. There are lists online of default credentials for routers, and someone who managed to connect to your router over the internet could use those credentials to seize control of the router. (If you can find these options in your router's administrative interface, turn off remote management and/or remote access.)
A comprehensive list of default router passwords is at, yep, http://www.routerpasswords.com. Another long list is at https://www.bestvpn.com/guides/default-router-login-details/. If you've misplaced your router instructions and don't know the default credentials, look them up there.
Three: Update your router's firmware, either before or after the factory reset.
Malware attacks routers whose firmware hasn't been updated, so this is an easy way to protect yourself. We have comprehensive firmware-update instructions for most major router brands here.
(But if your router is already infected, a firmware update won't clean it out; only a factory reset will. You can find out how to test if your router might be infected here.)
How to Factory-Reset an Apple Router
Apple AirPort Extreme, AirPort Express Base Stations and AirPort Time Capsules all have reset buttons, though they're not easy to see at first. Look for a small white button; there's often a gray circle with a white triangle printed on the case next to the button.
But just pressing the button will merely reset the password. For the full factory reset, you'll need to disconnect the power, press the button and then reconnect the power. Keep holding down the button until the amber LED on the unit flashes.
More details, including diagrams, are on this Apple support page. The company's default passwords vary a lot by model, but you can try "admin", "root" or blank for the username, and "admin", "alpine", "public" or "root" for the password.
How to Factory-Reset an Asus Router
Asus recommends that users go into the administrative interface, browse to the Administration section, and go to Restore/Save/Upload Setting to first save the existing configuration to a PC or Mac. After that, you can click Restore in the Factory Default section.
Alternately, you can just press the factory-reset button for at least 10 seconds. No power cut-off is needed.
Once that's done, and if you saved the configuration, use the default credentials (both the username and password will be "admin") to log in to the browser interface to upload the old configuration to the router.
How to Factory-Reset a D-Link Router
All D-Link routers can be factory-reset using the Reset button, which is usually on the back of the device.
However, we found at least one model, the DIR-842, on which the reset button is also the WPS button; in this case, hold down the WPS button for at least 8 seconds.
Regarding default administrative credentials, a page on the D-Link support website states, "For DIR-xxx routers, the default username is 'admin', and there is no password. For DSR-xxx routers, the default username and password is 'admin'."
How to Factory-Reset a Google Router
Google makes one model of router, Google Wifi, which can be used as a single unit or in sets to create a local mesh network.
Like with the Apple Airport devices, you can factory-reset a Google Wifi "point" (what Google calls each Google Wifi device) by just disconnecting the power, pressing the reset button on the back, then plugging it back in while holding down the reset button and waiting for the lights (blue in this case) to blink.
Doing this will wipe the device clean, but it will stay linked to your Google account, and so will the old usage data and other information tied to the device.
Google also puts it own branding on the older OnHub routers made by Asus and TP-Link, respectively. The Asus' reset button is next to the USB port on the back of the device. For the TP-Link, you'll need to twist the outer housing and lift it off; the reset button will be next to the power port. The reset procedure is the same as for the Google Wifi.
To de-associate a Google Wifi device or an OnHub device from your Google account and wipe the cloud data clean — which you might want to do when you're selling or giving away a unit — you'll need to use the Google Wifi mobile app. Find the Network & General setting, then Wifi Points, and then tap Factory Reset.
Google has more details here. There are no default credentials to remember, as Google doesn't use any. Instead, you set up each device by scanning a QR code on the router's bottom with the Google Wifi smartphone app.
How to Factory-Reset a Linksys Router
All Linksys routers can be factory-reset by pressing the reset button. There's no need to disconnect the power cord.
However, you might have to hold down the reset button for up to 30 seconds on some older devices. Following the reset, the default administrative username is usually either blank or "admin", and the default administrative password is usually "admin".
You can also use the browser administrative interface to factory-reset Linksys routers, but the result is the same. Details for both procedures are here.
How to Factory-Reset a Netgear Router
The factory-reset button works for all Netgear routers that have them, including the Orbi mesh-router line. You won't need to unplug any power cords. Here's a slightly more detailed explanation, along with a video.
Two DSL gateway devices, the Netgear DGN2000 and DG834Gv5, don't have a reset button. Instead, you press and hold both the Wireless On/Off and Wi-Fi Protected Setup (WPS) buttons at the same time, and hold them down for 6 seconds. When the power light blinks red, let go of both buttons and let the device reboot. Further details are here.
Default credentials vary by Netgear model, but "admin" seems to be the most common username and "password" the most common password.
How to Factory-Reset a TP-Link Router
Most models of TP-Link routers can be reset by holding down the reset button for 6 to 10 seconds; on some models, the Wi-Fi Protected Setup (WPS) and reset buttons are the same, but the same procedure applies. TP-Link's mesh routers, the Deco M5 and Deco M9 Plus, need only a quick press of the reset button.
The browser-based administrative interface for most TP-Link routers lets you back up the router configuration, including passwords and network names, to the PC or Mac from which you are accessing the administrative interface. That feature should be under System Tools>Backup and Restore. After you back up the configuration, you can jump up to Factory Defaults in the navigation bar and click the Restore button to factory-reset the device.
TP-Link has generic factory-reset instructions for its routers here. Its most common default credentials are "admin" and "admin," but there's some variation by model.