Forgotten password on a Androiddevice is a situation that almost every user has encountered. A pattern, PIN code or fingerprint may suddenly stop working after a system update, firmware failure or simple forgetfulness. If standard recovery methods via Google Account do not help, a computer comes to the rescue. With its help, you can bypass the blocking even without losing data - but only with the right approach.

In this article we will examine 5 working methods password reset via PC: from official tools (Find My Device) to advanced technical methods using ADB i Fastboot. Each option is illustrated with step-by-step guide, risk warnings, and data preservation tips. Important: Some methods require preliminary activation of USB debugging - if you have not enabled it in advance, some methods will not be available.

Before you start, check:

  • ๐Ÿ”Œ Do you have a USB cable (preferably original)
  • ๐Ÿ’ป Computer controlled Windows, macOS or Linux
  • ๐Ÿ”„ How critical is the data on the device (photos, messages, applications)
  • ๐Ÿ“ฑ Model and version Android (you can find out through mode Fastboot)

๐Ÿ“Š Which unlocking method have you tried before?
Find My Device
Reset via Recovery
ADB commands
Contacted the service center
Have not tried anything

1. Preparing the computer: drivers and tools

Before resetting the password, you need to configure the PC to work with the Androiddevice. Without the correct drivers and utilities, the computer simply will not see the smartphone or tablet.

For Windows required:

  • ๐Ÿ–ฅ๏ธ Install ADB drivers (download from the site Google or via SDK Platform Tools)
  • ๐Ÿ”ง Enable mode USB debugging (if the device is already unlocked at least once)
  • ๐Ÿ“ฆ Download package Platform Tools (contains adb i fastboot)

On macOS/Linux It is enough to install Platform Tools via the terminal and configure access rights.

Check the device connection with the command:

adb devices

If the serial number appears in the response, the drivers are installed correctly. If not, reinstall them or try a different USB port.

๐Ÿ’ก

On some. devices Samsung and Xiaomi requires additional confirmation of debugging permission on the smartphone screen. If the screen is locked, this method will not work.

2. Method 1: Unlocking via Google Find My Device (official method)

The safest and legal way is to use service Find My Device from Google. It works if:

  • ๐Ÿ“ฑ The device is linked to an account Google
  • ๐Ÿ“ถ Has access to the Internet (via a mobile network or Wi-Fi)
  • ๐Ÿ”„ The function Find a device is activated in the settings

Instructions:

  1. Go to the website Google Find My Device (log in with the same account as on your phone).
  2. Select a blocked device from the list.
  3. Tap Lock device and enter a new temporary password.
  4. Use this password to unlock your phone.

What to do if your device is not shown in Find My Device?

This means that either the account Google is not linked, or the function is disabled. In this case, try other methods from this article.

โš ๏ธ Attention: If two-factor authenticationis enabled on the device, confirmation via SMS or backup code may be required. Without access to them, unlocking via Find My Device is impossible.

3. Method 2: Password reset via ADB (USB debugging required)

The method is suitable for devices where USB debugging was previously enabled. If you have never connected your phone to a PC in developer mode, this method will not work.

Step-by-step guide:

  1. Connect your phone to the PC via USB.
  2. Open the command line (cmd) in the folder with Platform Tools.
  3. Enter the commands one by one:
    adb shell
    

    su

    rm /data/system/gesture.key

    rm /data/system/password.key

    rm /data/system/locksettings.db

    rm /data/system/locksettings.db-wal

    rm /data/system/locksettings.db-shm

    reboot

  4. After rebooting, the device will be unlocked.

If the command su does not work, then the device does not have one. root access. In this case, try the alternative:

adb shell

cd /data/data/com.android.providers.settings/databases

sqlite3 settings.db

update system set value=0 where name='lock_pattern_autolock';

update system set value=0 where name='lockscreen.lockedoutpermanently';

.quit

reboot

โš ๏ธ Attention: On devices with Android 10+ and encryption FBE (File-Based Encryption) this method may lead to data loss after reboot. Before use, make a backup copy through adb backup.

โ˜‘๏ธ Preparing for ADB unlocking

Done: 0 / 4

4. Method 3: Removing the password via Fastboot (for devices with an unlocked bootloader)

If your device has unlocked bootloader (bootloader), you can reset the password via the Fastbootmode. This method is suitable for most devices Xiaomi, OnePlus, Google Pixel and some models Samsung.

Instructions:

  1. Turn off the phone and hold down the key combination to enter Fastboot (usually Power + Volume Down).
  2. Connect the device to the PC and check its visibility:
    fastboot devices
  3. Enter the command to reset:
    fastboot erase userdata

    or (for some devices)

    fastboot format userdata
  4. Reboot the device:
    fastboot reboot

After this procedure, all data on the device will be removed, but the screen lock will be reset. If the bootloader is locked, you will need to unlock it first (on some devices this will reset the data).

Manufacturer Bootloader unlock command Data loss?
Xiaomi fastboot oem unlock Yes
Google Pixel fastboot flashing unlock Yes
OnePlus fastboot oem unlock No (on some models)
Samsung (Exynos) Odin required Yes
โš ๏ธ Attention: Unlocking the bootloader on devices Samsung with a processor Snapdragon can lead to the activation of protection Knox, which will deprive you of the warranty and access to some functions (for example, Samsung Pay).

5. Method 4: Using TWRP Recovery (for flashed devices)

If your device has TWRP custom recoveryinstalled, resetting the password will take only a few minutes. This method allows you to bypass the lock without losing data if you act carefully.

How it works:

  1. Boot into mode TWRP (usually Power + Volume Up).
  2. Go to section Advanced โ†’ File Manager.
  3. Delete the following files:
    • /data/system/gesture.key
    • /data/system/password.key
    • /data/system/locksettings.db
    • /data/system/locksettings.db-wal
    • /data/system/locksettings.db-shm
  • Reboot the device.
  • If after a reboot you are prompted to enter the old password, it means that the device is enabled encryption. In this case, only a full reset via Wipe โ†’ Format Data will help (all content will be deleted).

    ๐Ÿ’ก

    TWRP is the only method allowing you to reset the password WITHOUT losing data, but only if the recovery was installed IN ADVANCE. It is impossible to flash TWRP on a locked device.

    6. Method 5: Flashing the stock firmware (last resort method)

    If none of the previous methods worked, you can still reflash the device using the official one firmware. This is guaranteed to delete the password, but all data, applications and settings will also be erased.

    For firmware you will need:

    • ๐Ÿ“ฅ Official firmware for your model (download from the manufacturer's website or XDA Developers)
    • ๐Ÿ–ฅ๏ธ Utility for firmware:
      • Samsung โ€” Odin
      • Xiaomi โ€” Mi Flash Tool
      • Google Pixel, OnePlus โ€” Fastboot

    Example of firmware via Fastboot:

    fastboot flash boot boot.img
    

    fastboot flash system system.img

    fastboot flash userdata userdata.img

    fastboot reboot

    For Samsung via Odin:

    1. Run Odin in mode administrator.
    2. Connect the phone in mode Download Mode (Power + Volume Down + Bixby).
    3. Add the firmware files to the appropriate fields (BL, AP, CP, CSC).
    4. Click Start and wait for completion.

    โš ๏ธ Attention: Firmware for unofficial or modified firmware can lead to brick (breakage) of the device. Use only official firmware from trusted sources.

    7. What to do if nothing helps?

    If all of the above methods do not work, there are two options left:

    1. Contact the service center. Official centers Samsung, Xiaomi and other brands can unlock the device using purchase documents (sometimes for a fee).
    2. Use hardware methods. Some workshops offer firmware flashing services (via test points on the board), but this is risky and expensive. ISP-firmware (via test points on the board), but this is risky and expensive.

    Before visiting the service:

    • ๐Ÿ“„ Take with you a receipt or box from the device (proof of ownership).
    • ๐Ÿ” Check whether the data will be saved after unlocking (usually not).
    • ๐Ÿ’ฐ Find out the cost of the service (can reach 30-50% of the price of a new phone).

    If the device is not valuable and the data is not critical, sometimes it is cheaper to buy a new smartphone than to pay to unlock the old one.

    FAQ: Frequently asked questions about password reset Android

    Is it possible to reset a password without losing data?

    Yes, but only if:

    • The device has TWRP encryption installed and disabled.
    • You have previously enabled USB debugging and you can use ADB.
    • The device is synchronized with Google Account, and you remember your login/password.

    In all other cases, the data will be lost.

    Why does the phone ask for the old password after resetting via Fastboot?

    This happens due to data encryption (FDE or FBE). Even after resetting the password, the system requires the old key to decrypt user data. Solution:

    • Do full Wipe via Recovery (everything will be deleted).
    • Flash the device again with formatting userdata.

    Does the method with ADB work on Android 12/13?

    On new versions Android (12+), the method with deletion gesture.key often does not work due to enhanced encryption. Instead, try:

    adb shell am start -n com.google.android.gsf.login/
    

    adb shell am start -n com.google.android.gsf.login.LoginActivity

    This will launch an account entry window Googlethrough which you can unlock the device.

    Can you unlock your phone if you have forgotten your Google account?

    If you don't remember your account details Googlelinked to the device, unlocking via Find My Device or ADB is impossible. There are only methods with a full reset:

    • Firmware via Fastboot/Odin.
    • Reset via Recovery (if a password is not required to log in).
    • Contacting the service center with proof of ownership.

    How to avoid blocking in future?

    To avoid encountering the problem again:

    • ๐Ÿ”‘ Use biometric unlocking (print or face) as a backup option.
    • ๐Ÿ“ Write down the PIN code to a safe place (for example, in Google Keep with encryption).
    • โš™๏ธ Turn on Smart Lock to automatically unlock in safe places (home, work).
    • ๐Ÿ”„ Create backup copies regularly via Google Drive or ADB.