How to remove a pattern lock on Xiaomi without losing data: 5 proven ways

Forgot the pattern lock on Xiaomi, and the phone has important photos, correspondence or work documents? The situation is familiar to many: after several failed attempts to enter, the system locks the device for 30 seconds, a minute, and then offers to reset all data through Recovery. But what if a factory reset is not an option?

In this article, we’ll break down Xiaomi’s legal and semi-official unlocking methods (including Redmi, POCO, Black Shark) without data loss. Important: the effectiveness of the methods depends on the version MIUI (12, 13 or 14), a smartphone model and a linked Mi Account. Some methods require prior preparation, such as the one on. USB-If you don't have any of these, go straight to the section about unlocking through Mi Account.

Warning: Attempts to circumvent the protection can lead to the blocking of the Mi Account (if the device is associated with the account) or the activation of Factory Reset Protection (FRP).

Why Xiaomi is blocking the bypass of the pattern lock

Xiaomi’s MIUI-based smartphones use a multifaceted security system that makes unauthorized access more difficult, and these are key reasons why standard bypass methods (like resetting through Recovery) lead to data loss:

  • πŸ”’ File system encryption: Starting with Android 6.0, all user data (photos, messages, apps) are encrypted with a unique key tied to a graphical password or PIN-Without it, the system can't decrypt files even after resetting them.
  • πŸ›‘οΈ Mi Account Protection. If the phone is synchronized with the Mi Account, after resetting via Recovery, you will need to enter a login / password from the account.
  • 🚫 Banning ADB In the latest versions, it's locked. MIUI 13/14 the ability to connect to ADB (Android Debug Bridge without pre-activation USB-debugging.

The manufacturer deliberately limits the way users are circumvented to protect them from data theft, but there are loopholes that allow you to unlock the device without formatting – if you know where to look.

πŸ“Š What kind of smartphone you Xiaomi?
Redmi Note 10/11/12
POCO X3/X4/X5
Mi 11/12/13
Black Shark
Other

Preparation: What to check before unlocking

Before you start bypassing the pattern lock, answer these questions:

  1. Is there a Mi Account on your phone (remember your login and password)?
  2. Whether it was on. USB Debugging (debugging by USB) lock-in?
  3. Do you have a backup of your data (e.g., in Mi Cloud or on PC)?
  4. What version of MIUI is installed on the device?

The answer depends on the choice of method. USB-Debugging activated, can be used ADB-commands to delete gesture.key file (where the graphical password is stored). If not, you will have to rely on official Xiaomi tools.

β˜‘οΈ Checklist before unlocking

Done: 0 / 5

If your phone is under 20%, plug it into charging for 10-15 minutes. Some methods (like Fastboot) require stable power.

Method 1: Unlocking with Mi Account (official method)

The most reliable and legal way is to use a linked Mi Account, which works on most Xiaomi devices if:

  • πŸ“± The phone is connected to the Internet (Wi-Fi or mobile data).
  • πŸ”‘ You remember the username (email or phone number) and password from your Mi Account.
  • πŸ”„ More than 5 failed attempts to enter a password were not made on the device (otherwise the account may be temporarily blocked).

Instructions:

  1. On the lock screen, tap the Forgot Password button (or Forgot Password?).
  2. Select the recovery option through Mi Account.
  3. Enter your email/phone number and password. If two-factor authentication is enabled, confirm your login via SMS or email.
  4. Follow the instructions on the screen, and the system will suggest you create a new pattern lock or PIN-code.

⚠️ Note: If you have previously changed your Mi Account password but have not updated it on your phone, additional verification may be required through the user account. SMS backup email.

What if the β€œForgot Password” button does not appear?
On some models (e.g. Redmi Note 8 Pro or POCO F1), the password recovery button is hidden. Try: 1. Connect to Wi-Fi (even if the phone is locked, sometimes the network connects automatically). 2. Enter the wrong password 5 times - then a restore button should appear. 3. If nothing helps, go to the method from Fastboot or EDL.

Method 2: Remove gesture.key via ADB (if debugging is enabled)

If the phone has been activated in advance USB-debugging, you can delete the file with a graphic password through ADB. This method works for MIUI 12-14, but requires access to a computer.

What you need:

  • πŸ–₯️ Computer with installed ADB Tools.
  • πŸ”Œ Original. USB-cable (low-quality cables may not transmit data).
  • πŸ“± Phone with a charge of at least 30%.

Step-by-step:

  1. Connect your phone to your PC via USB.
  2. Open the command prompt (cmd) in the folder with ADB.
  3. Enter the command to check the connection: adb devices If the device appears in the list, go further. If not, install drivers for your Xiaomi model.
  4. Delete the file with the pattern lock: adb shell rm /data/system/gesture.key
  5. Reboot your phone: adb reboot

Once you reboot, the pattern lock will reset and you can install a new one. If the rm command doesn't work, try an alternative path: adb shell rm /data/system/locksettings.db.

πŸ’‘

If the phone still requires a password after removing gesture.key, try entering any arbitrary key – sometimes the system misses it as β€œempty”.

Method 3: Unlocking via Fastboot (for stitched devices)

It is suitable for users who have unlocked the bootloader and have experience with Fastboot. If you have never unlocked the bootloader on your Xiaomi, this method will not work.

Warning: Incorrect commands in Fastboot can cause a device to fail completely. Use this method only if you are confident in your actions.

Instructions:

  1. Turn off the phone. Press Volume down + Power to enter Fastboot mode.
  2. Connect the device to your PC and check the connection: fastboot devices
  3. Download custom recovery (such as TWRP) for your model.
  4. Select recovery: fastboot flash recovery twrp.img (replace twrp.img with your file name).
  5. Recovery: Fastboot Reboot Recovery
  6. In TWRP, go to Advanced β†’ File Manager and delete files: /data/system/gesture.key, /data/system/locksettings.db, /data/system/locksettings.db-wal, /data/system/locksettings.db-shm.
  7. Reboot the phone.

⚠️ Note: On some models (Redmi Note 9 Pro, POCO X3 NFC) post-fix TWRP An anti-rollback can work to lock the device. Before using this method, check the compatibility of your model in the forums. XDA Developers or 4PDA.

Method 4: Unlocking through EDL (for power users)

EDL (Emergency Download Mode) is an emergency firmware mode that allows you to reflash your phone even with a locked bootloader.

  • πŸ”§ Special cable (EDL cable) or board lintels.
  • πŸ’» Mi Flash Tool and official firmware for your model.
  • πŸ”‘ Authorized Mi Account (for new devices).

Step-by-step:

  1. Download the official firmware for your model (choose the Fastboot version).
  2. Install the Mi Flash Tool on your PC.
  3. Put your phone in EDL mode: Turn off the device. Press Volume up + Volume down and connect to your PC via USB. Or disassemble the phone and close the EDL contacts on the board (requires soldering skills).

Mi Flash Tool

Flash

Wait for the firmware to be completed (10-15 minutes).

⚠️ Attention: Firmware through EDL deletes all data unless you use special scripts to save the partition /data. This method is only suitable if other methods have not worked and the data is not critical.

MethodConditions requiredData retentionDifficulty
Mi AccountLinked account, Internetβœ… Yes.⭐
ADBOn. USB-debuggingβœ… Yes.⭐⭐
Fastboot + TWRPUnlocked bootloaderβœ… Yes (with the right actions)⭐⭐⭐
EDLSpecial cable, firmware.❌ No (no scripts)⭐⭐⭐⭐

Method 5: Alternative methods (for older models)

If you have Xiaomi on Android 5-7 (e.g. Redmi 4X, Mi A1), you can try bypassing the pattern lock through service codes or an emergency call.

Method 1: Through the emergency call screen

  1. On the lock screen, tap the Emergency Call (or Emergency Call).
  2. Enter the code ##7378423## (some models run #197328640##).
  3. Go to the service settings menu and find the option to reset the pattern lock.

Method 2: Reset Google Password (for Android 5-6)

  1. Enter the wrong pattern lock 5 times.
  2. Tap it Forgot the password? β†’ Enter Google data.
  3. Enter the login and password from the Google account that was linked to the phone.

⚠️ Note: These methods only work on older versions. MIUI On modern devices (Redmi Note 10 and later) they are useless.

πŸ’‘

On devices with MIUI 13/14 and Android 11+, you can bypass the pattern lock without losing data only through Mi Account or ADB (if debugging was enabled in advance).

Frequent questions

Can you unlock Xiaomi without losing data? USB-debugging was off?
Yes, but only through Mi Account (if the phone is connected to the Internet and you remember the data from the account). Other methods (ADB, Fastboot) require pre-activation of debugging or unlocked bootloader.
What if after resetting via Mi Account, the phone requires an old password?
This means that the key file has not been completely deleted. Try: Enter any arbitrary pattern lock (sometimes the system accepts it), Repeat the recovery procedure through Mi Account, contact Xiaomi support with proof of ownership of the device (check, box).
Does the method work with gesture.key removal on MIUI 14?
Yes, but with reservations: Some models (Xiaomi 13, Redmi Note 12) may call the file locksettings.db or password.If hardware encryption is enabled, deleting the file may not work.
Can I unlock Xiaomi through a service center without a check?
Official Xiaomi service centers require proof of purchase (check, warranty card or box). without documents they will refuse to unlock. The alternative is informal workshops, but there is a risk of losing data or getting a locked device (due to FRP).
What is FRP and how to get around it on Xiaomi?
FRP (Factory Reset Protection is Google's protection, which is activated after resetting if a Google account was linked to the phone. On Xiaomi, it works alongside Mi Account Protection. FRP You can do this by entering data from the Google account that was on the phone, using Fastboot commands (requires an unlocked bootloader), through the firmware of a special FRP-bypass. ZIP-file TWRP.