Jump to content

Forgot your Android display pattern/password/PIN? Solution on how to unlock it

From Android Wiki

An android smartphone can be protected from unauthorized access using a pattern, a PIN or a password. Each time someone wants to use the device, the previously setup pattern, PIN or password needs to be entered to gain access.

Unfortunately, it's possible, especially when the device is not used for a long time, that the owner of the device can not remember the setup pattern, PIN or password. To gain access again, there're different approaches which are explained on this page. The solutions differentiate themself, in general, by the ability to be able to access the data saved in the device afterwards. Some of the provided solutions include the loss of the data saved on the device, as long as there was no backup made before.

Generally spoken: Currently, there's no way of gaining access to the device without loosing all of data saved on it, as long as the you can not have have root access on it.

Solution 1: Reset pattern/PIN/password using Find My Device

Some users where able to reset their display security using the service Find My Device. For that, open your google account and navigate to the Security section and scroll down to the Your devices area. Click on Manage devices (direct link). In the list of the devieces, click on the 3-dot-menu of the device you want to unlock and select the function Search Smartphone. On the new page, you can use the feature Lock smartphone where you can reset the display security with a new password.

Alternatively, the feature is also available from the Find My Device portal.

In newer versions of the service, Google does not allow to set a new password for the display security anymore, if there's already a display protection setup. If you lock your device, the already setup pattern/PIN/password is used.

Some device manufacturers provide a similar service, which may also allow you to unlock the device using a web interface. Usually, it is required to activate that service or feature beforehand. If you did that before you forgot your pattern, PIN or password, you may be able to unlock your device using one of the services. Among others, these manufacturers provide such a webservice:

  • Samsung: Find My Mobile
  • Sony: MyXperia (service discontinued and forwards to the Find My Device portal from Google)

Solution 2: delete pattern/PIN/password (requires root access)

No data will be deleted when using this solution.

There's a possibility to delete the pattern, PIN or password setup on the device.Cite error: The opening <ref> tag is malformed or has a bad name When doing this, the device is acting as if there was no setup display protection at all. This, however, is only allowed to be done on your own device; doing it on devices you do not own may be a violation of laws.

In order to do this, the device needs to have USB debugging enabled or there needs to be an alternative recovery installed on the phone which allows to execute shell commands through the ADB.

Furthermore, you need to install the ADB from the Android SDK[1] and root access to the phone.

  1. Connect the phone with your computer
  2. Open a:
    • terminal on a linux-based computer
    • a command-line window on Windows computers (by pressing the Windows key together with the [R] key and type "cmd" in the Run window followed by pressing the [Return] key. You may also need to navigate to the installation location of the adb.exe
  3. Execute the following commands:
adb remount
# für ein Muster
adb shell rm /data/system/gesture.key
# für ein Passwort/eine PIN
adb shell rm /data/system/password.key

Afterwards the pattern is deleted. If the phone is still requesting to put in a pattern, PIN or password, you can enter whatever you want, the phone will give access no matter what you put in there. If you got access to the device, navigate to the settings and setup a new display protection.

Android 6.0+

Since Android version 6.0 verweis=Android/M "Marshmallow", information regarding the lock method of the display protection and related data is not saved in the gesture.key or password.key files anymore, but instead in new files which contents will be calculated using the gatekeeper-service.[2][3][4][5][6] That also means, that you need to delete different files when trying to unlock an android 6.0 verweis=Android/M "Marshmallow" device with this solution:

adb remount adb shell rm /data/system/gatekeeper.password.key
adb shell rm /data/system/gatekeeper.pattern.key
adb shell rm /data/system/locksettings.db


If an android device has a display protection setup, a file named gesture.key or password.key (or the gatekeeper files on Android 6.0 verweis=Android/M "Marshmallow" devices and higher) is created in the /data/system directory. In this file, all required information about the pattern, PIN and password are stored. If you remove these files (using the linux utility rm), the system does not know the protection anymore and will accept anything.

Solution 3: Reset the phone

Using this solution you will loose all data saved on the device.

If no other solution is available anymore, the last thing possible is to reset the phone.

Possibility A

The easiest and hassle-free , but also a non-free possibility to reset the phone is by letting your provider to that. Usually you need to send your device to an address provided to you by the carrier and pay a fee for that. Not all carriers may provide such a service and the cost may vary a lot as well.

Possibility B

Most manufacturers provide a way to reset the phone through their bootloader of recovery system (a so called factory reset). The way of doing it may depend on the device you're using, but usually the following steps needs to be done:

  1. Turn off the device
  2. Press the Volume up- (Home-) and Power on-key simultaneously
  3. Navigate to the function Factory Reset (or similar) using the Volume up and down keys and confirm the selection with the power on key
  4. You may need to confirm that you want to reset the device by navigating to yes with the Volume up and down key nd confirm your selection with the power on key

The device usually restarts after the reset was done and the pattern/PIN/password, as well as all the other data on the device, are deleted. You also need to setup the phone from scratch now.

On Samsung and Sony devices (not all devices may support this, though), you can also reset the phone from the emergency call screen:

  1. Seelct the Emergency key on the display security screen
  2. Enter the following number:
    • Samsung: *2767*3855#
    • Sony: *#*#7378423#*#*
  3. The device will be resetted


  1. Lua error: Internal error: The interpreter exited with status 127.
  2. Lua error: Internal error: The interpreter exited with status 127.
  3. Lua error: Internal error: The interpreter exited with status 127.
  4. Lua error: Internal error: The interpreter exited with status 127.
  5. Lua error: Internal error: The interpreter exited with status 127.
  6. Lua error: Internal error: The interpreter exited with status 127.
Cookies help us deliver our services. By using our services, you agree to our use of cookies.