Screen locks on smartphones are a vital way to keep the contents of your device private. In an age when you have personal, professional, and financial information on your phone, locking your mobile has become a necessity instead of a choice.

It goes without saying that if you forget your phone passcode, you can get locked out of your device. There's a greater risk of forgetting thanks to the fingerprint scanners on modern devices that render passwords as a backup.

Here are some ways that you can regain access to your Android phone if you forget your password.

Are You Sure You Forgot It?

If you've just typed "How do I unlock my Android phone if I forgot my PIN" into Google and found yourself in this article, before you proceed any further, it's wise to take a moment to make sure you've actually forgotten your passcode. While this may seem obvious, it will save you a lot of hassle in the long run.

Android lets you choose any number of digits for your PIN. If you're trying to recall a four or six-digit code, consider whether your passcode is actually a different length. This may help you remember it. Another trick to try is allowing your muscle memory to do the work. Go away and do another task, then pick up your phone and see which keys your fingers automatically move to.

But if you have definitely forgotten your Android PIN, then here are some ways to unlock your phone.

1. Unlock With Smart Lock

Smart Lock is an Android feature that lets you specify certain conditions that bypass your lock screen security. You'll find it under Settings > Security > Smart lock on most phones, or Settings > Lock Screen > Smart Lock Type on Samsung devices.

However, you must have set it up before you forgot your PIN!

You're required to input your current lock password to make changes to the feature. Then you can choose five possible options to unlock your smartphone without a password:

  • On-body detection: The phone senses that you're carrying it and automatically stays unlocked while it's in your hands or your pocket.
  • Trusted places: Uses your location to unlock your phone when you're near an address that you've selected.
  • Trusted devices: Keeps your device unlocked when connected to a trusted Bluetooth device, like your fitness tracker or car.
  • Trusted face: Uses facial recognition to unlock your phone.
  • Voice match: When it recognizes your trusted voice, it unlocks your phone. Unfortunately, this option was discontinued in Android 8 Oreo and beyond, although it still works on earlier devices.

If you've already set up one or more of these options before you forgot your password, you can use it to get back into your phone.

However, you can't change Smart Lock or password settings without entering your current password. Thus, you may still need to factory reset your Android phone, but at least you can back everything up first.

2. Options for Samsung Devices

Have a Samsung device? Thankfully, the company offers a couple of ways to reset your lock code if you forget it.

Using Backup PIN (Older Android Versions Only)

If you have an old Samsung phone running Android 4.4 KitKat or earlier, you may have set a backup PIN. After entering your password or pattern incorrectly, follow these steps:

  1. Tap on the Backup PIN option if you can remember it.
  2. Type in your PIN code, then tap Done.
  3. You will be redirected to the Screen Unlock settings to reset the lock screen pattern.

Find My Mobile (All Android Versions)

You don't have to be concerned if you've forgotten your device's screen lock code (e.g., PIN, password, or pattern).

For all of its phones, Samsung offers a feature that lets you remotely manage the device if you lose it. You'll need to be signed in to your Samsung Account on your phone and must have either a Wi-Fi or mobile data connection.

To reset your phone's passcode through Find My Mobile, follow these steps:

  1. On your computer, navigate to findmymobile.samsung.com.
  2. Now, sign in to your Samsung account.
  3. Once done, go to the Unlock my Device option and follow the instructions.

3. Use the Forgot PIN Prompt

If you have an older phone with Android 4.4 KitKat or earlier, you can reset your passcode through the lock screen. This uses your Google account and requires the following steps:

  1. Input the wrong pattern into the lock screen until you see a You have made several unsuccessful attempts. Try again in 30 seconds message.
  2. Tap on Forgot Pattern, and you'll see a prompt to enter your Google account information.
  3. Type in your email address and password.
  4. You now have the option of resetting your lock screen pattern. Simply tap on the Sign-in tab, then go to the Screen Unlock settings and set a new lock screen pattern.

Unfortunately, Google removed this option in modern versions of Android.

4. Try Some Workaround Hacks

If you haven't set up Smart Lock, don't have an old phone, or don't use a Samsung device, the above methods won't help. In those cases, you'll have to use a workaround hack.

Delete the PIN File Using ADB

In Android, the system generates a KEY file to keep all of your user credentials, such as your fingerprint, pattern, or other passwords. This is to ensure that when you input the correct password, the system unlocks immediately and denies access to the phone when the wrong password is entered.

Using the Android Debug Bridge (ADB) utility, you can access your phone's files through your computer. You can utilize this to delete the file that controls the phone's lock screen security.

However, this method will only work if:

  • USB debugging is enabled on your phone. If you've never dived into the Developer Options panel, then you don't have it enabled.
  • You've allowed your computer to connect to your phone via ADB. We have a guide to using ADB if you're not familiar.
  • Your phone is not encrypted. Starting with Android 6.0 Marshmallow, Google requires all Android phones to ship encrypted. Thus, this won't work for newer devices.

This method isn't guaranteed to work, and if you're not careful, it could damage your phone. As a result, we highly recommend that you back up everything on your Android device before continuing.

If your phone meets these requirements, you can unlock your phone with the following steps:

  1. Connect your phone to your computer via a USB cable.
  2. Open a Command Prompt or Terminal window to your ADB installation directory.
  3. Type in adb shell rm /data/system/gesture.key and hit Enter.
  4. Reboot your phone. Once you do, the secure lock screen should be gone.
  5. This is a temporary condition, so reset your PIN or pattern lock before rebooting again.

Crash the Lock Screen

This method works for encrypted devices running Android 5.0 to 5.1.1. Thus it's only suitable for a small subset of phones but is worth a try if you happen to fit into this.

To crash the lock screen and gain access to your phone:

  1. Tap the Emergency Call option on your lock screen.
  2. Use the dialer to input 10 asterisks.
  3. Double-tap to highlight this text and select Copy.
  4. Paste the selected characters next to the original copied characters.
  5. Keep repeating this process of adding more characters to the password space until double-tapping no longer highlights the characters.
  6. Open the camera shortcut and pull down the notification shade.
  7. Tap the settings icon, where you will be prompted to enter the password.
  8. Long-press the input field and choose the Paste option. Then repeat the process several times to copy and paste more characters.
  9. Eventually, the lock screen will crash and allow you to access your device.

5. Perform an Android Factory Reset

If none of the above works for you, you'll have to resort to a factory reset. Of course, this erases all the data on your phone as well. If you've signed into your Google account and backed up to it, you can sign back into that same account after the reset and restore a lot of your data.

Since you're locked out, you'll need to use another method to do the reset. The easiest way is to use Google's Find My Device website. As long as you've enabled this feature on your phone, you can click the Erase device option on this page to reset it.

If you can't use this method, you'll need to factory reset manually. To do so:

  1. Power your device off.
  2. After the screen goes completely black, press and hold the volume down and power buttons simultaneously to bring up Android's bootloader menu. This button combination may be different depending on your phone.
  3. Press the volume down button twice to highlight the Recovery Mode option, then press the power button to select it.
  4. Hold the power button and press the volume up button once to enter recovery mode.
  5. Use the volume buttons to go to the Wipe data/Factory Reset option. Proceed with the steps to perform a factory reset.
  6. Once the device reboots, walk through the setup again. You'll be prompted to log back into your Google account, which will restore any backed-up data.

We recommend that you enable the Smart Lock feature as soon as you set up your phone. In this way, you can effortlessly unlock your Android phone on your home Wi-Fi and avoid manually unlocking your phone each time.

Preventing Future Lockouts on Android

These methods can get you back into your Android phone, but they won't help you remember your password for future logins. You don't want to have to go through these steps again, so it's better to take precautions now so you won't forget your passcode in the future.

Here are a few tips for remembering your Android password in the future.

  • Keep a physical copy of your password in a place that only you can access, like in a safe or password manager.
  • Always use a strong password that you can remember instead of using something obvious.
  • Make sure you're signed in to your Google (and Samsung, if applicable) accounts, and have enabled at least one Smart Lock option.
  • Back up your Android data to soften the blow if you have to factory reset again.

Remembering Your Passcodes

These days, we're prompted to have a password for almost everything, and it can be tricky to remember them all. Password managers can help you to keep tabs on all of your different passwords, but they aren't very useful if you've forgotten your Android phone PIN.

To prevent you from having to read this article again in the future, it's worth having your Android phone passcode written down somewhere safe at home.