Are you moving on to a new phone from your trusty Galaxy s5? Whether you’re selling your old device, giving it to a friend, or plan to throw it into your junk draw, you’ll want to wipe the phone clean first. Performing a factory reset is easy, but there are some critical things you need to know before you get started.

In this article, we’ll cover everything you’ll need to do to perform a factory reset on your device.

Backing up your device

Before you think about wiping your Galaxy S5, make sure you have backed up all of your precious files. You can back up basic data inSettings > Backup & reset. For the rest of your files, you can use a backup app or service. You get 15GB of free storage with Google Drive, for instance, and there are a host of other alternatives to choose from, such as My Backup Pro and SMS Backup & Restore.

Encrypting your data

A security firm recently revealed that it is possible to recover some data after a factory reset, but you may take a precautionary step to prevent this from being possible before you reset the phone. If you’re selling your S5, or merely passing it on to someone else, then we recommend encrypting it first.

To do so, go toSettingsand chooseSecurityfrom in theSystemsection. SelectEncrypt device, follow the onscreen instructions, select a password, and plug in your charger if prompted. This process can take an hour or more, but once complete, you’re able to follow the instructions below.

Performing a factory reset

Pull down the notification shade and tap the gear icon to bring upSettings.ChooseBackup and resetand thenFactory data reset.

Double check that everything is backed up and then tapReset deviceat the bottom of the screen. TapDelete allon the next screen and wait for the process to complete and the phone to reboot. You’re done.

NOTE: If you’re wiping your S5 to sell it on or give it away, then we recommend removing accounts before you factory reset. You can do this by going toSettings > Accounts, tapping on each account and then tappingMoreat the top right andRemove account.

How to factory reset a Galaxy S5 using hardware keys

If you find that the touchscreen is unresponsive, there’s a problem accessing the menu, or you forgot your pattern lock, then you’re able to still factory reset your S5 using the hardware keys.

Step 1:Turn your Galaxy S5 off.

Step 2:Simultaneously press and hold theVolume upbutton, theHomebutton, and thePowerbutton until the Android icon appears on your display.

Step 3:UseVolume downto highlight thewipe data/factory resetoption, and press thePowerbutton to select it.

Step 4:UseVolume downagain to highlightYes — delete all user data,and pressPowerto select it.

Step 5:Wait until you see thereboot system nowoption and use thePowerbutton to select it.

Step 6:When your S5 restarts, it should be wiped and ready to set up again.